How to Clean Homebrew Cache on Mac: Reclaim Gigabytes of Space
Alex Rivero
Lead Performance Engineer
format_list_bulleted Quick Navigation (Table of Contents)
If you are a developer using macOS, you likely use Homebrew daily to install packages and software. But over time, you might notice Homebrew taking up space on your Mac—sometimes tens of gigabytes! This happens because every time you update a package, Homebrew downloads new source tarballs and binary "bottles," while keeping all the old versions around just in case.
In this comprehensive guide, we'll cover exactly how to clean Homebrew cache on Mac, explain how to perform a deep brew cleanup mac operation, and reveal the default Homebrew cache location mac so you can understand where all that storage went. Let's reclaim your disk space!
storage 1. Why Homebrew Quietly Fills Your Mac's Storage
When you run brew update and brew upgrade, Homebrew downloads new versions of software. However, by default, it rarely throws away the old ones immediately. Every update leaves behind a trail of artifacts:
- Bottles: Pre-compiled binary packages for macOS.
- Source Tarballs: Downloaded source code used to compile software locally.
- Casks: Downloaded DMG or ZIP files for full GUI applications (like Google Chrome or Docker).
- Old Cellar Versions: Homebrew keeps previous versions of installed software inside its "Cellar" directory in case you need to roll back.
Before you know it, clearing homebrew downloads mac becomes an urgent necessity to free up your SSD.
How to Check Brew Cache Size Mac:
Open your Terminal and run the following command to see exactly how much space the cache is hoarding:
If that number is over 5GB, it is definitely time for a cleanup.
folder_open 2. Where Homebrew Stores Downloaded Bottles & Casks
The homebrew cache location mac varies slightly depending on whether you are using a newer Apple Silicon Mac (M1/M2/M3/M4) or an older Intel-based Mac.
Apple Silicon (M-series) Macs
On Apple Silicon, Homebrew installs its executables to /opt/homebrew. However, the cache is stored in your user library:
Intel Macs
On Intel Macs, Homebrew uses the traditional Unix path /usr/local for executables, but the cache location remains the same user library path:
Inside this cache directory, you will find two main subdirectories to note: downloads/ which contains the raw files, and Cask/ which holds downloaded macOS app binaries.
cleaning_services 3. Essential brew cleanup Commands Every Developer Should Know
The primary way to handle a homebrew taking up space mac situation is via the built-in brew cleanup command. Here is the safest and most effective workflow:
-
Dry Run (See what will be deleted)
Before deleting anything, you can run a dry run. The-nor--dry-runflag tells Homebrew to list the files it would delete without actually removing them.brew cleanup -n -
Standard Cleanup
This removes older versions of installed formula and clears old downloads.brew cleanup -
Aggressive Scrubbing (--prune=all)
Sometimes standard cleanup isn't enough. To remove ALL cached files (even for the latest versions of software), use the prune flag.brew cleanup -s
brew cleanup --prune=all -
Remove Unused Dependencies
Over time, you might uninstall a package, but its dependencies remain installed (orphaned). To clear them out:brew autoremove -
Run a Diagnostic
Finally, runbrew doctorto ensure your Homebrew installation is healthy and there are no unlinked files causing bloat.brew doctor
Tired of remembering terminal commands? Clean it all in 1 click.
Dusty automatically finds bloated Homebrew caches, orphaned node_modules, old Xcode simulators, and Docker images. Safely reclaim 20GB+ of space in seconds.
brew install theappcenter/tap/dusty
delete_sweep 4. How to Remove Old Package Versions from Cellar
A major culprit of wasted disk space is the Homebrew Cellar cleanup. The Cellar is where Homebrew actually stores the unpacked, compiled software.
Sometimes, multiple versions of the same programming language or database stick around (e.g., keeping Node 18, 20, and 22 simultaneously). You can check if you have multi-version packages hoarding space by running:
If you see multiple version numbers next to a package, it means the old versions are still on your drive. Running brew cleanup usually fixes this, but if a formula was pinned, you might need to manually uninstall the old version using:
bolt 5. Automated Developer Cleanup with Dusty AI
Manually running cleanup scripts is tedious. While Homebrew handles its own cache reasonably well with the right commands, developers have other hidden caches: npm, pip, Docker, Xcode, and gradle.
This is where Dusty shines. Dusty is an AI-powered storage cleaner designed specifically for macOS developers. Instead of blindly wiping directories, Dusty uses an on-device Gemini 1.5 Flash model to analyze your system and safely identify:
- Stale Homebrew caches and orphaned downloads.
- Forgotten
node_modulesfolders in archived projects. - Massive Xcode derived data and old iOS simulators.
- Dangling Docker images and volumes.
With its 100% reversible trash-first deletion, you can confidently clean up 50GB of developer bloat with a single click, knowing that nothing critical will be permanently destroyed without your final approval.
update 6. Automate Homebrew Cleanup Going Forward
To prevent having to search "how to clean homebrew cache mac" in the future, you can set an environment variable in your shell profile (~/.zshrc or ~/.bash_profile) to automatically remove old versions after an upgrade.
Add this line to your shell configuration:
This tells Homebrew to automatically run a background cleanup of caches older than 30 days, keeping your Mac lean without any manual intervention.
Reclaim Storage Instantly with Dusty
Stop hunting through hidden Library folders and terminal commands. Let Dusty's AI safely analyze and clean your developer caches in minutes.