brew cleanup: How to clear Homebrew cache on Mac
You can clear Homebrew cache on a Mac with brew cleanup without risk: the cache holds old downloads of formulae and apps and old versions of the tools you upgraded. Homebrew cleans up now and then by itself, but the cache still grows to gigabytes. Here is how to clean it partly or fully, remove dependencies you no longer need, and what stays.

- Open MacWashing and choose System Junk in the sidebar.
- Click Start Scan.
- Look through what it found and click Clean. Anything debatable stays unchecked.
Free trial · macOS 14 or later
What Homebrew keeps
Homebrew saves every file it downloads, formulae and casks alike, in its download cache. This command shows where it is, by default ~/Library/Caches/Homebrew:
brew --cache
Besides downloads, old versions of upgraded formulae stay installed until a cleanup removes them.
Clean up with brew cleanup
brew cleanup removes outdated downloads of all formulae and casks, downloads older than 120 days, old versions of installed formulae and stale lock files. To see first what it would remove, run:
brew cleanup -n
Then run the cleanup itself:
brew cleanupThe current versions of your formulae and the apps installed with --cask stay.
How to clear Homebrew cache completely
This command deletes all cache files, whatever their age. Homebrew downloads again what it needs for the next install or upgrade:
brew cleanup --prune=allThe -s option also scrubs downloads of the latest versions, which a normal cleanup keeps.
Remove dependencies you no longer need
When you uninstall a formula, the formulae it depended on stay. brew autoremove uninstalls formulae that were installed only as a dependency and no longer needed by anything. See the list first:
brew autoremove -n
If the list is fine, run brew autoremove. To keep a tool from it that you use yourself, add its name to the HOMEBREW_NO_CLEANUP_FORMULAE environment variable first: Homebrew never cleans up or autoremoves the formulae listed there.
Automatic cleanup
brew install,brew upgradeandbrew reinstallclean up after the formulae they touched, and every 30 days they clean up all formulae.HOMEBREW_CLEANUP_MAX_AGE_DAYSchanges the 120-day limit for cached files.HOMEBREW_NO_INSTALL_CLEANUPturns automatic cleanup off. Then runbrew cleanupyourself.
New to Homebrew? See how to install Homebrew.
With MacWashing, it’s one click

System Junk in MacWashing clears the Homebrew download cache together with the caches of your other apps and tools. Your installed formulae and casks stay.
Free trial · macOS 14 or later
Questions and answers
Will MacWashing delete my own files when it cleans?
No. It removes only what it can match to a known app or a known kind of junk, in places apps leave files; macOS and Apple’s files are never touched. Anything debatable is marked and stays unchecked until you decide.
What about apps that are open?
If an open app holds files being cleaned, MacWashing waits for it to quit or quits it at your request, and opens it again afterwards.
Is it free?
Yes, within the free trial: System Junk and the Uninstaller free up to 25 GB in total, with no account or card needed.
Does brew cleanup uninstall anything?
It removes old versions of formulae you upgraded, never the current ones. Apps installed with --cask stay. To remove unneeded dependencies, use brew autoremove.
Is it safe to delete ~/Library/Caches/Homebrew?
Yes. It holds downloads that Homebrew fetches again when needed. brew cleanup --prune=all does the same from Terminal.
How often should I run brew cleanup?
Homebrew cleans up after upgrades and fully every 30 days by itself. Run it by hand when you need space, or after big upgrades.