← All articles

Homebrew Is Hoarding 8 GB You Have Never Looked At

Every bottle Homebrew has ever downloaded is still on your Mac, including versions you upgraded away from years ago. One command fixes it.

HomebrewmacOSStorageCacheDeveloper

This one takes thirty seconds and is almost always worth several gigabytes.

du -sh "$(brew --cache)"

Typical result on a machine that has run brew for a couple of years: 4–10 GB.

What is in there

Homebrew downloads a bottle — a precompiled binary archive — for every formula you install, and keeps it. It also keeps the downloaded .dmg and .pkg files for every cask.

The keeping is deliberate and briefly useful: if an install fails halfway, or you reinstall the same version, Homebrew does not re-download. The problem is that it applies to every version. Upgrade Node fifteen times over two years and you have fifteen Node bottles, fourteen of which will never be used again.

Casks are the worst of it. A cask install downloads the full application installer — Docker Desktop is around 600 MB, Android Studio over 1 GB — and that installer sits in the cache forever after the app is installed.

Clear it

brew cleanup -s --prune=all
  • -s clears the download cache, including for formulae that are currently installed. Without it, brew cleanup only removes cached downloads for things no longer installed, which misses most of the space.
  • --prune=all removes everything from the cache regardless of age. The default only prunes files older than 120 days.

Preview it first if you want to see what goes:

brew cleanup -n -s --prune=all

Nothing here is destructive. Every file is re-downloadable from Homebrew’s servers, and clearing the cache does not touch a single installed program. The only cost is bandwidth if you reinstall something.

While you are here

Old versions of installed formulae. When Homebrew upgrades a package it usually keeps the old version in the Cellar. brew cleanup removes those too:

du -sh "$(brew --prefix)/Cellar"
brew cleanup --prune=all

Things you no longer use. Homebrew installs dependencies alongside what you asked for, and when you uninstall the top-level package the dependencies stay:

# Installed as dependencies, now depended on by nothing
brew autoremove

# What you explicitly asked for, versus everything installed
brew leaves
brew list --formula

brew leaves is a genuinely useful audit. It lists only packages you installed on purpose, and it is usually much shorter than you expect — everything else came along as a dependency.

Downloaded but broken state. If Homebrew is behaving oddly:

brew doctor

Keep it from coming back

Homebrew has run brew cleanup automatically every 30 days since 2018, so the situation improves on its own — but the automatic run does not use -s --prune=all, which is why the cache still grows.

Turn on aggressive automatic cleanup by adding this to your shell profile:

export HOMEBREW_INSTALL_CLEANUP=1

Or disable the periodic cleanup entirely and handle it yourself:

export HOMEBREW_NO_INSTALL_CLEANUP=1

For most people the honest answer is a calendar reminder every few months to run one command.

The bigger picture

Homebrew is not the worst offender on a developer’s Mac — Xcode and Docker each dwarf it — but it is the easiest to fix. One command, no risk, no downside, several gigabytes.

Everything else lives in the full developer storage guide: DerivedData, Docker, simulators and the node_modules problem.

Or let the map do it.

DevCruft finds every cache in this article, shows you what each one costs you, and clears them in one click.

Apple silicon & Intel · No account · Nothing leaves your Mac