brew cleanup: reclaim gigabytes from Homebrew the right way (2026)

Homebrew is the cleanest package manager most people never clean. Every brew upgrade leaves the old keg behind, every install caches its download, and garbage collection is opt-in. On a developer Mac, brew --cache alone regularly holds 2-8 GB.

The three commands that matter

brew cleanup -s          # remove old versions + stale downloads (the big one)
brew cleanup --prune=all # also clear downloads newer than the default 120d grace
brew autoremove          # remove orphaned dependencies nobody needs

Run brew cleanup -n first for a dry-run list of everything that would go. Typical reclaim on a machine with a year of usage: 3-10 GB.

What brew cleanup does NOT touch

LeftoverWhereManual?
Global npm/npx cache~/.npmYes — see our npm guide
Python wheels~/Library/Caches/pipYes
Cask app leftovers~/Library/…Yes — uninstall checklist
Old Launch Agents~/Library/LaunchAgentsReview manually

Automate it

One launchd timer a week is enough. Or fold it into a broader sweep — our package-manager cache guide has a combined script. If you would rather never think about it, MacCleaner PRO schedules cache sweeps including brew paths.

When Homebrew itself is the problem

If /opt/homebrew (Apple silicon) or /usr/local (Intel) exceeds 15-20 GB, the issue is usually duplicated language runtimes installed by formulae. Audit with brew list --formula | wc -l and brew deps --installed --tree | less; uninstall the runtimes you did not consciously choose.

Related

Brew is one layer of the developer-cache stack — the full picture is in System Data explained and the cleanup hub. To see everything at a glance, the disk waste estimator above estimates your total in ten seconds.