What is the Homebrew cache on Mac? Is it safe to delete?
Yes, the Homebrew cache is safe to delete. It contains downloaded installers and archives, not the installed software, so everything you installed with brew keeps working.
Where it is
~/Library/Caches/HomebrewWhat it is
When you run brew install or brew upgrade, Homebrew downloads a bottle, source archive or cask installer into ~/Library/Caches/Homebrew and then installs from it. The download is kept afterwards in case it is needed again.
Cask downloads are often the biggest items, because they are full app installers. Each upgrade adds another download.
Homebrew does run a periodic cleanup of old downloads and old versions, but the cache can still build up between runs. You can print its location with brew --cache.
How big it gets
From hundreds of MB to several GB, depending on how many casks and large formulae you install.
How to clear it by hand
- Open Terminal.
- Run the command below. It removes old versions of installed formulae and scrubs the download cache, including downloads for the versions you currently have installed.
- To preview what would be removed first, run brew cleanup -n.
brew cleanup -sWhat happens afterwards
Nothing changes for installed software. If you reinstall a formula or cask later, Homebrew downloads it again.
How Diskzy handles it
Diskzy lists the Homebrew cache in the Clean up tab and ticks it.
Related guides
See where your Mac's space went
Diskzy maps your disk, explains System Data and clears what's safe. Free for 72 hours, then $9 once for 2 Macs.
Try Diskzy for free