Is it safe to delete ~/Library/Caches/Homebrew?
- Yes. It holds bottles and installers Homebrew already downloaded; what you’ve installed runs from elsewhere. Let
brew cleanupdo it, because it also removes old versions of formulae you’ve upgraded. - What it costs you: reinstalling a formula or cask later downloads it again.
- Does it come back? Yes. Every install and upgrade adds downloads, and Homebrew trims them on its own schedule.
- SiftMac’s verdict: Rebuilds
1. What Homebrew keeps
To install something, Homebrew downloads it (a bottle for a formula, an installer for a cask), installs it, and keeps the download in its cache in case you reinstall. Inside you’ll find:
downloads: the files themselves, named with a long hash.- Entries named
<formula>--<version>next to it, which point at those downloads. Cask: installers for apps added withbrew install --cask.api: Homebrew’s lists of formulae and casks, fetched again when needed.
There’s a second place space goes. Each upgrade installs the new version of a formula next to the old one in the Cellar. Homebrew removes old versions when it upgrades and does a fuller cleanup every 30 days, unless HOMEBREW_NO_INSTALL_CLEANUP is set; then old versions pile up until you clean.
2. Where it is
~/Library/Caches/Homebrew
/opt/homebrew/Cellar # Apple silicon
/usr/local/Cellar # Intel
brew --cache and brew --cellar print the folders your Mac uses. HOMEBREW_CACHE moves the cache, for example to an external drive.
3. How big it gets
Downloads are kept for up to 120 days by default (HOMEBREW_CLEANUP_MAX_AGE_DAYS), so the cache mirrors your last few months of installs and upgrades. To see its size, and everything a cleanup would remove without removing it:
du -sh "$(brew --cache)"
brew cleanup --dry-run
4. Clearing it with brew cleanup
- Let any
brew installorbrew upgradefinish. - Run
brew cleanup. It removes stale lock files and outdated downloads for every formula and cask, removes downloads more than 120 days old, and removes old versions of installed formulae. - To empty the download cache completely, run
brew cleanup --prune=all, which removes cached files whatever their age. - Then check
brew autoremove --dry-run. Without--dry-runit uninstalls formulae that were only installed as dependencies and that nothing needs now.
brew cleanup
brew cleanup --prune=all
brew autoremove --dry-run
Don’t delete folders in the Cellar or the Caskroom by hand: Homebrew links each installed version into its bin and other folders, and brew uninstall is the way to remove a package you don’t need.
5. What happens next
- Everything you’ve installed keeps working. The cache is only read during installs.
- Reinstalling a formula or cask downloads it again, which needs the network.
- Old versions that cleanup removed are gone. If you need a formula held at its current version,
brew pinit so upgrades skip it. - Homebrew keeps trimming on its own: after installs and upgrades, and fully every 30 days (
HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS).
Questions
Does brew cleanup uninstall anything I use?
No. It removes downloads and the old versions of formulae you’ve already upgraded. Dependencies are only uninstalled by brew autoremove, and only those nothing installed still needs.
What’s the difference between brew cleanup and brew cleanup --prune=all?
Plain brew cleanup removes downloads for versions you no longer have and anything older than 120 days. --prune=all removes every cached file whatever its age, so any later reinstall downloads again.
Can I delete ~/Library/Caches/Homebrew in Finder?
Yes, with no brew command running; Homebrew’s own help gives rm -rf "$(brew --cache)" for clearing everything. brew cleanup is still the better habit, because it also removes old versions from the Cellar, which deleting the cache doesn’t.
Why is /opt/homebrew still big after a cleanup?
Most of it is what you have installed. brew leaves lists formulae that no other installed formula or cask depends on, so you can spot ones you stopped using and remove them with brew uninstall.
How SiftMac handles it. Its App caches category lists ~/Library/Caches/Homebrew as Homebrew downloads with a Rebuilds verdict and clears what’s inside, keeping the folder. It doesn’t touch the Cellar or anything you’ve installed: old versions are Homebrew’s to remove, with brew cleanup.
Download SiftMac · scanning is free, and so is your first 2 GB of cleaning · See how it works