Package managers & build caches

Is It Safe to Delete the Homebrew Cache? What brew cleanup Removes vs Breaks

If you've looked at your Mac storage and spotted a multi-gigabyte folder hiding in ~/Library/Caches/Homebrew, you've probably wondered: is it safe to delete the Homebrew cache? The short answer is yes — the cache is entirely expendable and Homebrew will rebuild it on demand. But understanding what lives there, what brew cleanup actually touches, and where edge cases arise will help you clean with confidence rather than crossing your fingers.

What Is the Homebrew Cache and Where Does It Live?

Every time you run brew install or brew upgrade, Homebrew downloads a compiled binary (a "bottle") or source tarball before installing it. Those downloads are stored in a local cache so that a reinstall doesn't require a fresh download. On macOS the cache lives at:

  • Apple Silicon (M1/M2/M3/M4): /Users/<you>/Library/Caches/Homebrew
  • Intel: same path — ~/Library/Caches/Homebrew

On older Homebrew setups you might also find files under /Library/Caches/Homebrew (the system-level cache used when Homebrew was installed to /usr/local). The canonical way to confirm the exact path on your machine is:

brew --cache

That command prints the active cache directory so there's no guesswork. Typical sizes range from a few hundred megabytes on a fresh machine to 10 GB or more on a Mac that has been running Homebrew for years without cleanup.

What Does brew cleanup Actually Remove?

brew cleanup is Homebrew's built-in housekeeping command. By default it removes downloaded bottles and source archives for formula versions that are no longer installed. In other words, if you upgraded from Node 20 to Node 22, the Node 20 bottle sitting in the cache gets deleted because there's no current install that needs it.

What it does not remove:

  • The currently installed version's cached bottle (Homebrew keeps it in case you need to reinstall without internet).
  • Files that were cached less than 120 days ago, unless you pass the --prune=all flag.
  • Cask downloads in ~/Library/Caches/Homebrew/Cask that belong to currently installed apps.
  • Symlinks, Cellar contents, or any file outside the cache directory — brew cleanup is cache-only.

To do a dry run and see exactly what would be deleted without actually removing anything:

brew cleanup --dry-run

How Much Space Can You Reclaim? A Typical Breakdown

Cache bloat builds up silently. The table below shows representative sizes from a developer machine running macOS Sequoia after three years of active Homebrew use — your numbers will vary but the proportions are typical.

Cache subfolder What's inside Typical size Safe to delete?
~/Library/Caches/Homebrew/downloads/ Bottle tarballs (.tar.gz) for previously installed formula versions 2 – 8 GB Yes — fully regenerable
~/Library/Caches/Homebrew/Cask/ Installer DMGs and PKGs for Homebrew-managed GUI apps 1 – 5 GB Yes — re-downloaded on reinstall
~/Library/Caches/Homebrew/api/ JSON formula/cask metadata fetched by brew update 50 – 200 MB Yes — rebuilt automatically on next brew update
~/Library/Caches/Homebrew/Formula/ Cloned formula Git repos (older Homebrew versions) 0 – 500 MB Yes — only present on legacy setups

How to Safely Delete the Homebrew Cache: Step-by-Step

There are two approaches depending on how aggressively you want to clean.

Option A — Use brew cleanup (Recommended)

  1. Open Terminal.
  2. Run a dry run first to see what will go: brew cleanup --dry-run
  3. Review the output. If it looks reasonable, run the real cleanup: brew cleanup
  4. To remove everything including files newer than 120 days, add the prune flag: brew cleanup --prune=all
  5. Check how much you recovered: du -sh ~/Library/Caches/Homebrew

Option B — Manual Deletion

If you want to nuke the entire cache folder (perhaps Homebrew is misbehaving), you can safely delete ~/Library/Caches/Homebrew in Finder or with:

rm -rf $(brew --cache)

The next brew install or brew upgrade command will re-download whatever it needs. Nothing currently installed on your Mac is affected — installed software lives in /opt/homebrew/Cellar/ (Apple Silicon) or /usr/local/Cellar/ (Intel), completely separate from the cache.

What brew cleanup Does NOT Touch

It's worth being explicit about what is out of scope, because many developers also accumulate large package-manager caches from other tools that look similar:

  • npm / pnpm / yarn cache — lives in ~/.npm or ~/Library/Caches/Yarn, not the Homebrew cache. See our guide on cleaning up node_modules on Mac for that workflow.
  • Cargo (Rust) cache — stored in ~/.cargo/registry/cache and ~/.cargo/git. Cleaned with cargo cache --autoclean (after installing the cargo-cache crate).
  • Maven cache — lives in ~/.m2/repository and can grow to several gigabytes of JARs.
  • Xcode DerivedData — stored in ~/Library/Developer/Xcode/DerivedData and is entirely separate. See our post on why Xcode takes up so much space for that rabbit hole.
  • pip / conda environments — Python package caches under ~/Library/Caches/pip are not touched by Homebrew at all.

A tool like Crumb can audit all of these at once and show what's safe before you delete, rather than requiring you to track down each cache directory manually.

Will Deleting the Cache Break Any Installed Software?

No. The cache and the installed software are entirely independent on disk. The Homebrew Cellar (where binaries, libraries, and man pages actually live) is never touched by brew cleanup. Deleting ~/Library/Caches/Homebrew does not uninstall anything, does not break existing CLI tools, and does not affect your shell PATH.

The only practical consequence is that if you need to reinstall a formula immediately after clearing the cache, Homebrew will download the bottle again from its CDN rather than pulling from the local cache. On a decent connection this takes seconds to minutes depending on the package size.

Automating Homebrew Cache Cleanup

Homebrew itself runs an automatic cleanup 30 days after you last ran it manually (controlled by the HOMEBREW_INSTALL_CLEANUP environment variable, which is enabled by default since Homebrew 2.1). You can also schedule it explicitly. A lightweight approach is a launchd plist or a crontab entry:

# Add to crontab with: crontab -e
0 9 * * 1 /opt/homebrew/bin/brew cleanup --prune=all >> ~/Library/Logs/brew-cleanup.log 2>&1

This runs every Monday at 9 AM and logs output to ~/Library/Logs/brew-cleanup.log. Adjust the path to /usr/local/bin/brew if you're on an Intel Mac with the default Homebrew prefix.

Alternatively, you can add export HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS=30 to your ~/.zshrc to have Homebrew do a full prune automatically every 30 days when you run any brew command.

Checking Homebrew Cache Size Before and After

Before any cleanup, it's useful to get a baseline so you know what you actually freed. Run:

du -sh $(brew --cache)

For a more granular breakdown by subfolder:

du -sh $(brew --cache)/*

After cleanup, run the same command again to confirm the delta. On machines that have never been cleaned, it's common to reclaim 5–15 GB in a single pass — a meaningful chunk on a 256 GB or 512 GB SSD.

Reclaim your disk in one click

Crumb audits your whole Mac, tells you what's safe to delete, and frees the space in seconds — private, local, and Apple-notarized.

Download Crumb for macOS

Frequently asked questions

Is it safe to delete the Homebrew cache on a Mac?
Yes, completely safe. The Homebrew cache at ~/Library/Caches/Homebrew only stores downloaded bottle tarballs and installer packages used during installation. Deleting it does not remove any installed software — those files live in /opt/homebrew/Cellar (Apple Silicon) or /usr/local/Cellar (Intel) and are untouched by cache deletion.
What is the brew cleanup command and what does it delete?
Running 'brew cleanup' removes cached downloads for formula versions that are no longer installed on your Mac. It leaves the cache for currently installed versions intact. Add '--prune=all' to remove everything including files newer than 120 days, or use '--dry-run' first to preview what will be deleted.
Where exactly is the Homebrew cache located on macOS?
The cache lives at ~/Library/Caches/Homebrew on both Apple Silicon and Intel Macs. You can always confirm the exact path by running 'brew --cache' in Terminal — it prints the active cache directory for your Homebrew installation.
How much space can I recover by deleting the Homebrew cache?
It varies by how long you've been using Homebrew without cleanup. On a machine active for 2-3 years it's common to reclaim 5–15 GB. The downloads subfolder holding old bottle tarballs is usually the largest contributor, followed by cached Cask installer DMGs for GUI apps.
Will deleting the Homebrew cache force me to re-download packages if I reinstall?
Yes, but only for packages you uninstall and reinstall after clearing the cache. Any currently installed formula or app continues to work normally because installed files live in the Cellar, not the cache. Re-downloads are fast — Homebrew uses a global CDN and most bottles are a few hundred megabytes at most.