If you use Homebrew, you have probably noticed it quietly accumulating gigabytes of old downloads, outdated formula versions, and stale tarballs in the background. Learning how to clean Homebrew cache properly — and understanding exactly what brew cleanup removes — can reclaim several gigabytes without touching anything you still need.
Why Homebrew Takes Up So Much Disk Space
Homebrew keeps old versions of installed packages so you can roll back if a new release breaks something. Every time you install or upgrade a formula, the previous compiled version stays in the Cellar. On top of that, Homebrew caches the raw source tarballs and bottles it downloads, so reinstalling is faster. Neither of these is cleaned up automatically.
The two main culprits are:
- The Homebrew Cellar — installed packages live at
/usr/local/Cellar(Intel Macs) or/opt/homebrew/Cellar(Apple Silicon). Each formula subdirectory can contain multiple version folders. - The download cache — tarballs, bottles, and patch files are cached at
~/Library/Caches/Homebrew. This directory grows every time you install or upgrade anything.
The brew cleanup Command
brew cleanup is the built-in command that removes old versions from the Cellar and clears the download cache. It is safe for most use cases, but understanding its flags helps you decide how aggressively to clean.
Basic cleanup
brew cleanup
This removes all formula and cask versions that are older than the currently installed version, as long as they are not pinned. It also deletes cached downloads older than 120 days. After running this on a machine that has not been cleaned in a while, it is common to reclaim anywhere from 1 GB to 5 GB depending on how many packages you have upgraded over time.
Preview what will be removed (dry run)
brew cleanup --dry-run
Prints everything that would be deleted without actually removing anything. Run this first if you want to see what is queued before committing.
Remove everything from the cache regardless of age
brew cleanup --prune=all
The --prune flag accepts a number of days; --prune=all removes all cached downloads unconditionally. Use this when you want to wipe the entire ~/Library/Caches/Homebrew directory. The download cache is always safe to delete — Homebrew will re-download anything it needs on the next install or upgrade.
Clean a specific formula
brew cleanup git
Removes only old versions of the named formula. Useful when you know one package has accumulated many versions but you do not want to touch anything else.
How to See Exactly What Is Taking Space
Before cleaning, it is worth knowing how large each area actually is.
- Check the total size of the download cache:
du -sh ~/Library/Caches/Homebrew - Check the total size of the Homebrew Cellar:
du -sh /opt/homebrew/Cellar # Apple Silicon du -sh /usr/local/Cellar # Intel - List all installed formula with their sizes:
brew list --formula | xargs -I{} sh -c 'echo "{}: $(du -sh $(brew --prefix)/Cellar/{} 2>/dev/null | cut -f1)"' - See which packages have multiple versions installed:
brew list --versions
Dealing with Pinned Formulas
brew cleanup skips any formula you have pinned with brew pin <formula>. Pinning tells Homebrew not to upgrade a package, and cleanup respects that by keeping all its installed versions. To see what is pinned:
brew list --pinned
If you no longer need a pin and want cleanup to include that formula going forward:
brew unpin <formula>
Removing Packages You No Longer Need
Cleanup only removes old versions of currently installed packages. It will not remove a package you installed six months ago and forgot about. To find packages that are not needed by anything else:
brew autoremove
This removes any installed formula that was pulled in as a dependency but is no longer required by any installed package. Run brew autoremove --dry-run first to preview the list.
What Is Safe to Delete vs. What to Leave Alone
| Location | Safe to delete? | Notes |
|---|---|---|
~/Library/Caches/Homebrew |
Yes | Download cache only; Homebrew re-downloads on next use |
| Old version folders in the Cellar | Yes, via brew cleanup |
Do not delete manually — let Homebrew manage the Cellar structure |
| Currently installed version in the Cellar | No | Active binaries and libraries; use brew uninstall instead |
| Pinned formula versions | Only after unpinning | Run brew unpin first if you want cleanup to include these |
Homebrew itself (/opt/homebrew) |
Only if uninstalling entirely | Use the official uninstall script, not manual deletion |
Important: Cleanup is permanent. There is no Trash — deleted versions and cached tarballs are gone. If you need to downgrade a formula after cleaning, Homebrew will need to re-download or recompile the older version.
Automating Cleanup
Homebrew runs a background cleanup task roughly every 30 days, but it only clears downloads older than 120 days and does not do the full --prune=all pass. If you want a more thorough cleanup on a schedule, add this to your shell profile or a cron job:
brew cleanup --prune=all && brew autoremove
For Non-CLI Users: Crumb's Developer Cleanup
If you share a Mac with teammates who are not comfortable in Terminal, Crumb includes a Developer cleanup category that detects the Homebrew download cache and stale old-version folders. It surfaces them alongside your other disk bloat in a single scan, so someone who does not know the difference between --prune and --dry-run can still reclaim that space safely. You can download Crumb and run it alongside your regular brew cleanup habit — they target the same files, so there is no conflict.
A Realistic Before and After
The space you reclaim depends entirely on how long you have been using Homebrew and how often you upgrade packages. A laptop that has been running Homebrew for two or three years without any cleanup typically sees:
~/Library/Caches/Homebrew: 500 MB to 3 GB cleared by--prune=all- Old Cellar versions: 200 MB to 2 GB cleared by the base
brew cleanup - Unused dependencies: variable, often 100–500 MB from
brew autoremove
On a freshly upgraded machine or one that runs cleanup regularly, the numbers will be much smaller. The only way to know your actual number is to run brew cleanup --dry-run and check the output.
Quick Reference
# See what will be removed (no changes made)
brew cleanup --dry-run
# Standard cleanup: old versions + downloads older than 120 days
brew cleanup
# Aggressive: old versions + ALL cached downloads
brew cleanup --prune=all
# Remove unused dependencies
brew autoremove
# Check what is pinned (cleanup skips these)
brew list --pinned
# Check cache size before and after
du -sh ~/Library/Caches/Homebrew
Running brew cleanup a few times a year — or after any major batch of upgrades — keeps Homebrew from quietly eating your disk. Pair it with brew autoremove and the occasional --prune=all pass and you will rarely see Homebrew listed as a significant consumer in your disk usage reports.