Homebrew Cache on Mac: Is It Safe to Delete?

Low riskPackage managers & build toolsUpdated

Facts from the app
Location
  • ~/Library/Caches/Homebrew
Risk level
Low riskRebuilt automatically by macOS or the app that made it. Freshist selects these for you — you still see every item before anything moves.
Selected by default
Yes
What Freshist does
Moves the selected items to the Trash, so you can undo. Nothing is deleted outright.
In the app
Clean → Homebrew Cache — “Downloaded install archives. Homebrew re-downloads them if ever needed.”

From Freshist's own cleaning rules — the same catalog the app uses.

What lives in the Homebrew cache

Every time you run brew install, brew upgrade or brew reinstall, Homebrew first downloads something: a precompiled bottle (a .tar.gz of a formula built for your macOS version), a source tarball if no bottle exists, or the .dmg, .pkg or .zip behind a cask. Those downloads land in the cache folder, and brew installs from there.

You'll typically find:

  • downloads/: the actual files, named with a hash prefix so different versions don't collide.
  • Symlinks at the top level pointing into downloads/, with friendlier names like node--22.9.0.arm64_sequoia.bottle.tar.gz.
  • Cask/: links to cask installers.
  • api/: the JSON formula and cask index brew fetches instead of cloning the old Git taps.
  • bootsnap/: a small cache that speeds up brew's own Ruby startup.

Right after a cleanup the folder may hold little more than api/ and bootsnap/. Nothing in here is your data.

Why it grows

Homebrew already tidies up after itself. According to the Homebrew FAQ, it removes old versions when you upgrade and runs a fuller cleanup every 30 days. brew cleanup itself removes downloads more than 120 days old.

The cache still grows if you install large casks (IDEs, browsers, design tools), upgrade often, or set HOMEBREW_NO_INSTALL_CLEANUP=1, which turns the automatic pass off. Big cask installers are usually the bulk of it, since brew keeps the latest download for each installed package.

What happens if you delete it

RemovedEffect
Downloaded bottles and source tarballsRe-downloaded the next time a formula is installed or reinstalled
Cask installersRe-downloaded on the next cask install or upgrade
api/ index filesFetched again on the next brew update or install
Installed formulae, casks, settingsNot affected; they live outside the cache

The only practical loss is offline reinstalls. If you rely on reinstalling a specific old version without a network connection, keep its file.

Check its size first (read-only)

brew --cache                 # prints the cache path
du -sh "$(brew --cache)"     # total size
brew cleanup -n              # dry run: lists what cleanup would remove

brew cleanup -n is the useful one. It shows exactly what brew considers stale before anything is touched.

Clear it the Homebrew way

Use brew's own command before reaching for Finder:

  1. brew cleanup removes stale lock files, outdated downloads and old installed versions, plus any download older than 120 days. Change that window with HOMEBREW_CLEANUP_MAX_AGE_DAYS.
  2. brew cleanup -s also scrubs downloads for the latest versions. Downloads of installed packages are still kept.
  3. brew cleanup --prune=all removes every cache file regardless of age.

Homebrew's own help text names one more step if you want the folder empty: rm -rf "$(brew --cache)". That is safe, but it's the blunt option, so run the dry run first and quit any brew command that's still running.

Clearing the cache does not remove old installed versions in the Cellar. brew cleanup handles those separately, and brew cleanup -n lists them too.

When the cache is worth keeping

Keep the cache if you work on a slow or metered connection and expect to reinstall soon, or if you maintain a machine image and want installers on hand. Otherwise, a periodic brew cleanup is enough. For other developer folders that grow the same way, see developer caches on Mac and the npm cache guide.

Sources

Frequently asked questions

Does clearing the Homebrew cache uninstall any packages?

No. Installed formulae live in the Cellar under your Homebrew prefix (/opt/homebrew on Apple silicon, /usr/local on Intel) and casks install into /Applications. The cache only holds the files they were installed from.

Why is the cache still large after brew cleanup?

By default brew cleanup keeps downloads for everything currently installed and only removes stale files older than 120 days. Use brew cleanup -s to scrub downloads for the latest versions too, or brew cleanup --prune=all to drop everything older than zero days.

Can I move the Homebrew cache to another drive?

Yes. Set the HOMEBREW_CACHE environment variable in your shell profile to another folder, and brew will download there instead. brew --cache then prints the new location.

Keep reading