Homebrew keeps downloads in ~/Library/Caches/Homebrew (brew --cache prints it) and old versions of formulae in its Cellar, /opt/homebrew/Cellar on Apple silicon. Plain brew cleanup often frees almost nothing, because Homebrew already cleans up after itself and keeps recent downloads and the installers of what you have installed. brew cleanup --prune=all clears the whole cache. Run it with -n first to see what goes.
Why brew cleanup frees so little
I ran three dry runs on my Mac (Homebrew 7.0.11, 130 formulae, a 528 MB cache). -n lists what would go and deletes nothing:
$ brew cleanup -n # nothing to remove $ brew cleanup -s -n # would free about 12.7 MB $ brew cleanup --prune=all -n # would free about 508 MB
The default found nothing at all. Three rules explain it:
- Homebrew already cleans up. After every
brew install,upgradeandreinstallit runs cleanup for those packages, and every 30 days for all of them. SettingHOMEBREW_NO_INSTALL_CLEANUPturns that off, which is the usual reason a cache grows large. - Recent downloads stay. The default removes downloads older than 120 days.
HOMEBREW_CLEANUP_MAX_AGE_DAYSchanges the number. - Installers for what you have installed stay, even with
-s(scrub). Only--prune=allremoves them.
On my Mac, 470 MB of the 508 MB was a single file: the DMG of OrbStack, an app I installed with brew install --cask. Homebrew kept the installer because that version is still installed. Cask installers are often the largest thing in the cache.
See what's in the cache
These only read:
$ brew --cache $ du -sh "$(brew --cache)" $ du -sh "$(brew --cache)"/* "$(brew --cache)"/Cask/* 2>/dev/null | sort -h | tail
You'll see downloads/ (bottles and installers), Cask/ (app installers), api/ (Homebrew's package index, about 30 MB) and bootsnap/ (a Ruby speed-up cache). The index and bootsnap come back on the next brew command, so there's no point removing them by hand.
Clear it
# see the list and the total first $ brew cleanup --prune=all -n # then remove $ brew cleanup --prune=all
--prune=all removes every cached download, whatever its age, plus old logs. It doesn't touch installed formulae or apps. If you reinstall one of them, Homebrew downloads it again.
The help text for brew cleanup also offers rm -rf "$(brew --cache)" to delete everything. It frees about the same space and skips Homebrew's own bookkeeping, so prefer --prune=all.
An installed formula or app never needs its download to run. The cost of clearing the cache is a fresh download if you reinstall the same version, nothing else.
Old versions in the Cellar
Every formula you install lives in the Cellar, one folder per version. brew cleanup removes old versions, with two exceptions:
- Pinned formulae (
brew list --pinned) keep every version. - Outdated formulae. If a newer version exists and you haven't installed it, cleanup skips the formula with
Warning: Skipping sqlite: most recent version 3.54.1 not installed. My Cellar still had two versions each ofsqlite,sdl3andsdl2-compatfor this reason.
So the order matters. Upgrade first, then clean:
$ brew upgrade $ brew cleanup
To find formulae with more than one version installed:
$ cd "$(brew --prefix)/Cellar" && for f in *; do n=$(ls "$f" | wc -l); [ "$n" -gt 1 ] && echo "$f $n"; doneDependencies you no longer need
When you uninstall a formula, the libraries it pulled in stay. brew autoremove uninstalls formulae that were only installed as a dependency and that nothing needs anymore:
$ brew autoremove -n # list them $ brew autoremove # uninstall them
Unlike the cache, this uninstalls software. Look at the list before you run it without -n. It found nothing on my Mac, but it often does after a few big uninstalls.
brew updates its package index before many commands, which can take a while. Set HOMEBREW_NO_AUTO_UPDATE=1 for the session if you only want to look.

A sensible routine
$ brew upgrade $ brew cleanup $ brew autoremove -n $ brew cleanup --prune=all -n # when you want the whole cache back
Homebrew is rarely the biggest cache on a developer's Mac. On mine, ~/.npm/_npx alone was 3.9 GB, more than seven times the Homebrew cache. To see every cache side by side, run diskreceipt, a free Terminal tool, or read the developer cache reference.
Sources
- Homebrew docs: brew cleanup and brew autoremove (Manpage)
- Homebrew docs: FAQ, "How do I uninstall old versions of a formula?"
- Homebrew docs: environment variables (HOMEBREW_NO_INSTALL_CLEANUP, HOMEBREW_CLEANUP_MAX_AGE_DAYS)
- Checked on this Mac on 30 October 2026 (macOS 26.5.1, Homebrew 7.0.11):
brew help cleanup,brew help autoremove,man brew, and dry runs ofbrew cleanup -n,brew cleanup -s -n,brew cleanup --prune=all -nandbrew autoremove -n. Nothing was deleted.