Developer storage · Updated September 14, 2026 · 7 min read

How to clean the Homebrew cache on Mac safely

Use Homebrew's own cleanup command so it can distinguish stale downloads and old formula versions from files your current installation needs.

Quick answer: run brew cleanup --dry-run first. Review the list, then run brew cleanup. Homebrew documents the cache at ~/Library/Caches/Homebrew by default on macOS, but brew --cache is the reliable way to find it.

Inspect before deleting

brew --cache
brew cleanup --dry-run
du -sh "$(brew --cache)"

The first command prints the active cache directory. The second previews stale downloads, locks, and old installed formula versions. The third only measures that directory. None removes data.

Choose the smallest cleanup

CommandWhat it doesWhen to use it
brew cleanupRemoves stale downloads and old formula versions under Homebrew's rules.Routine cleanup.
brew cleanup packageLimits cleanup to one formula or cask.You want narrow scope.
brew cleanup --prune=allPrunes all eligible cached files regardless of age.Disk pressure is urgent and downloads can be fetched again.
brew autoremove --dry-runPreviews dependencies no installed formula needs.After removing many formulae.
Do not start with recursive deletion. Homebrew's manual mentions removing the entire cache, but that also discards reusable downloads and is usually unnecessary. Avoid deleting anything outside the exact path printed by brew --cache.

What can be deleted—and what changes afterward?

Cached bottles and source archives can be downloaded again. Old installed formula versions are normally safe to remove after confirming the current version works. Cleanup does not remove your current requested formulae, project source code, or configuration files in your home directory.

If you work offline, are debugging an older bottle, or need an immediate rollback, keep the relevant download or old keg until that work is complete. Review brew autoremove --dry-run carefully: it concerns installed dependencies, not merely downloads.

GUI alternative

  1. In Finder choose Go → Go to Folder.
  2. Paste the result of brew --cache.
  3. Inspect large downloads, but prefer brew cleanup so Homebrew decides what is stale.

Where Homebrew fits in developer storage

Homebrew is only one source. Xcode simulators, archives, Docker images, npm caches, and dependency trees are separate. Use the Mac developer cache guide, or see how to reclaim Docker storage and delete Xcode Derived Data.

Prefer a visual review?
TrimyMac can surface cache and developer-storage candidates for review before cleanup.

Source

Commands and defaults were checked against the official Homebrew manual on September 14, 2026.