Free up the space Homebrew keeps
Last updated November 21, 2026
Homebrew keeps the downloads it installs from, and the old version of a formula each time it upgrades one, until a cleanup removes them. It cleans up by itself now and then, but a Mac that installs a lot can still hold gigabytes of them.
See what it would remove
Ask Homebrew first. This lists everything a full cleanup would remove and how much space it would free, without removing anything:
brew cleanup --prune=all -n-n is short for --dry-run. Homebrew keeps its downloads in the folder brew --cache prints, usually ~/Library/Caches/Homebrew.
Clean up
This removes old versions of what you’ve installed, stale lock files, and downloads older than 120 days:
brew cleanupTo remove every download in Homebrew’s cache, however new, add --prune=all:
brew cleanup --prune=allNeither touches the versions you use now. They only remove what Homebrew no longer needs, and if you ever reinstall something, Homebrew downloads it again.
Homebrew’s own cleanup
Homebrew already cleans up after brew install, brew upgrade and brew reinstall, and runs a full cleanup every 30 days, but only when you run one of those. If HOMEBREW_NO_INSTALL_CLEANUP is set, it never does, and old versions pile up until you clean up yourself.
Go carefully with brew autoremove
brew autoremove uninstalls what was installed only as a dependency of something else and that nothing needs now. It goes by how each formula was installed, not by what you use, so a tool that first arrived as a dependency and that you never installed by name goes too, even if you use it every day.
Run it as a dry run first, and read the list before you run it for real:
brew autoremove -nHow Diskwise handles it
Diskwise asks Homebrew itself. Its free scan runs brew cleanup --prune=all -n and shows what that would free as Homebrew leftovers, under Safe to clear, and cleaning them runs brew cleanup --prune=all. Diskwise never runs brew autoremove.
Rather not do it by hand?
Diskwise finds what fills your Mac, from build data to caches, sizes it honestly and clears what’s safe in one click. The scan is free.