Blog · Developers

How do I clean the Homebrew cache?

Run `brew cleanup --prune=all`. It removes old versions of what you have installed and every cached download, and Homebrew fetches anything it needs again on the next install.

Homebrew keeps two kinds of leftovers: the downloaded bottles and source archives it installed from, and old versions of formulae you have since upgraded. Neither is needed to run what you have installed, and on a busy machine together they reach several gigabytes.

Where it is

brew --cache

On most Macs that prints ~/Library/Caches/Homebrew. To see how big it is:

du -sh "$(brew --cache)"

See what cleanup would remove, without removing it

brew cleanup -n

The -n is a dry run: it lists what would go and frees nothing. Worth running once before the real thing, to see where the space is.

Clean it

brew cleanup

That removes outdated versions of installed formulae and cached downloads older than Homebrew’s default age limit. To clear every cached download regardless of age, which is usually what you want when the disk is full:

brew cleanup --prune=all

Two related commands that are not cache, but often free space at the same time:

  • brew autoremove uninstalls dependencies that nothing you installed needs any more.
  • brew list is worth reading once in a while — a formula you installed for one job years ago is still there until you brew uninstall it.

Is it safe?

Yes. Nothing you are using depends on the cache: installed formulae live in Homebrew’s own prefix, not in the download cache. The only cost is that the next brew install or brew upgrade of something you cleaned has to download it again.

Why it grows back

Every upgrade downloads new bottles, and Homebrew only tidies up after itself periodically. So the cache creeps back between cleanups; on the Mac this app was built on it was cleaned on 26 August and needed it again by 5 September. That is normal, and a regular clean is the answer rather than a bigger one.

Letting RefreshYourMac do it

RefreshYourMac measures Homebrew’s download cache as Homebrew Downloads, rated Safe for auto removal. Cleaning it runs brew cleanup --prune=all first, so old versions go too, and then clears what is left of the cache. Nothing is removed without a confirmation, and because it is Safe for auto removal it can also be part of Clean All Safe or a scheduled clean, which keeps it from creeping back.

The other package caches sit beside it — npm, Yarn and pnpm, CocoaPods and Gradle — each measured and cleaned separately. More in what fills up a developer’s Mac.

What to do next: see these numbers for your own Mac. Download Atzu Safe Data Cleaner free, or get it on the Mac App Store.

What it costs to have an app do this

Atzu Safe Data CleanerCleanMyMacMacKeeper
Pay once$24.99€119.95 on MacPaw’s store; $89.99 for CleanMyMac X on the Mac App Storesubscription only
Yearly$14.99 a year, first 7 days free$39.99/yr on the Mac App Store; €39.95/yr on MacPaw’s store€71.40 for the first year, 1 Mac. Their page shows it against a €119.40 list price
Monthly$1.99 a month$9.99/mo€10.95/mo
Account neededNoYesYes

Both versions' yearly plans start with 7 days free. CleanMyMac and MacKeeper prices read from their own pages and the Mac App Store on 27 October 2026; the full comparison is at Atzu Safe Data Cleaner vs CleanMyMac and MacKeeper.