Clear the Homebrew cache on a Mac
Homebrew keeps downloaded bottles and casks in ~/Library/Caches/Homebrew, plus old versions of formulae you upgraded. Run brew cleanup -n to preview, then brew cleanup to remove outdated downloads and old versions. brew cleanup --prune=all empties the download cache. Installed packages keep working, and Homebrew re-downloads anything it needs.
Why it gets big
Every time you install or upgrade a formula or a cask, Homebrew downloads it first and keeps the download in its cache. Casks are full app installers, so a few apps like browsers, IDEs or design tools can take a lot of room. Upgrades also leave the previous version of a formula in the Cellar until something cleans it up.
Homebrew does clean up on its own from time to time after installs and upgrades, unless you have set HOMEBREW_NO_INSTALL_CLEANUP. By default it removes downloads older than 120 days. Anything newer stays, and if you install a lot, that adds up. Because the cache sits in ~/Library/Caches, macOS counts it as System Data.
How to clear it by hand
1. See how big it is
brew --cache
du -sh "$(brew --cache)"The first line prints where the cache is, usually ~/Library/Caches/Homebrew. Old formula versions live in the Cellar, at /opt/homebrew/Cellar on Apple silicon and /usr/local/Cellar on Intel Macs.
2. Preview, then clean
brew cleanup -n
brew cleanup-n (or --dry-run) shows what would be removed and deletes nothing. The plain command removes outdated downloads, stale lock files and old versions of installed formulae.
3. Empty the download cache completely
brew cleanup --prune=all -n
brew cleanup --prune=all--prune=all removes cache files whatever their age. Your installed packages are not touched, but expect the next reinstall of any package to download it again.
4. Remove dependencies nothing needs
brew autoremove -n
brew autoremoveThis uninstalls formulae that were only installed as dependencies of something you have since removed. Read the preview: if you use one of them directly, install it explicitly with brew install first.
- Safe: anything
brew cleanupremoves. It is Homebrew’s own command and it keeps the versions you have installed. - Think first:
brew autoremove, which uninstalls packages rather than clearing a cache. - Avoid: deleting folders inside the Cellar by hand. Homebrew loses track of what is installed.
How Berth handles it
When Homebrew is installed, Berth measures ~/Library/Caches/Homebrew and counts the files in its downloads folder. It names the finding “Homebrew downloads” and explains that nothing you use changes.
- Re-downloadable: the Homebrew cache. Homebrew downloads a package again if you reinstall it.
Berth cleans it with Homebrew’s own command, brew cleanup --prune=all, instead of moving files itself. That command also removes old versions of installed formulae, which can free a little more than the size Berth shows for the cache.
One difference from other findings: a tool’s own cleanup does not use the Trash, so Undo cannot bring it back. Berth marks it “Can’t be undone” and leaves it out of the “add everything recommended” action, so you add it to the tray yourself. Berth does not run brew autoremove.
The Homebrew cache is counted with other package manager caches (npm, pip, Cargo, Gradle and more) when Berth splits up System Data.
Whatever Berth finds goes into a review tray first. A dry run shows exactly what would move, pre-flight checks make sure the owning app is closed, and everything goes to the macOS Trash, so Undo puts it back. Berth is free to scan and explore; one-click cleanup is part of Berth Pro, $14.99 one-time for 2 Macs. There is no account and nothing is uploaded.
Questions
Is it safe to delete the Homebrew cache?
Yes. It only holds downloaded installers. Your installed formulae and apps keep working. Homebrew downloads a package again if you reinstall it.
Where is the Homebrew cache on a Mac?
Usually ~/Library/Caches/Homebrew. Run brew --cache to print the exact path on your Mac.
What does brew cleanup do?
It removes outdated downloads, stale lock files and old versions of installed formulae. Add -n to see what it would remove first.
What is the difference between brew cleanup and brew cleanup --prune=all?
Plain brew cleanup removes outdated items and downloads older than 120 days. --prune=all removes all cache files, whatever their age.
Can I just delete the folder in Finder?
You can delete the cache folder, and Homebrew recreates it. brew cleanup is the better habit, because it also removes old versions from the Cellar.
