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=allflag. - Cask downloads in
~/Library/Caches/Homebrew/Caskthat belong to currently installed apps. - Symlinks, Cellar contents, or any file outside the cache directory —
brew cleanupis 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)
- Open Terminal.
- Run a dry run first to see what will go:
brew cleanup --dry-run - Review the output. If it looks reasonable, run the real cleanup:
brew cleanup - To remove everything including files newer than 120 days, add the prune flag:
brew cleanup --prune=all - 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
~/.npmor~/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/cacheand~/.cargo/git. Cleaned withcargo cache --autoclean(after installing thecargo-cachecrate). - Maven cache — lives in
~/.m2/repositoryand can grow to several gigabytes of JARs. - Xcode DerivedData — stored in
~/Library/Developer/Xcode/DerivedDataand 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/pipare 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.