Skip to main content
Mole
Overview Features Testimonials Pricing FAQ Blog
EnglishEN 简体中文中 繁體中文繁 日本語日 한국어한 FrançaisFR DeutschDE ItalianoIT EspañolES
Buy now Download
Home/Blog/Clean Up Homebrew Safely

Developer

Clean Up Homebrew Safely

June 25, 2026 · 3 min read

Homebrew manages old versions and cached downloads more actively than it once did: upgrades normally trigger cleanup, and Homebrew periodically runs cleanup on its own. A long-lived installation can still accumulate downloads, pinned versions, build artifacts, and dependencies. Inspect Homebrew's own metadata before deleting anything under its prefix.

What Homebrew keeps around

Three kinds of leftovers build up:

  • Old versions. Cleanup normally removes superseded versions, but retained or recently upgraded versions may remain in the Cellar for a time.
  • Downloaded archives. Every bottle and cask download is cached in Homebrew's cache, kept to avoid another download.
  • Orphaned dependencies. Packages that were only installed to support something you have since removed stay behind as unused clutter.

See the download cache size directly:

brew --cache
du -sh "$(brew --cache)" 2>/dev/null

Cleaning it up

The main command removes old versions and prunes the download cache in one step:

brew cleanup

By default, cleanup removes old installed versions and downloads older than its retention window. Use -n for a dry run. The deeper -s mode scrubs more cached downloads, while retaining downloads for currently installed formulae and casks:

brew cleanup -n
brew cleanup -s

To remove dependencies that nothing needs anymore:

brew autoremove --dry-run
brew autoremove

brew list shows installed packages and brew outdated shows pending updates. Use brew --cellar, brew --caskroom, and brew --cache to discover paths instead of hardcoding /opt/homebrew; Intel and Apple silicon installations differ.

Safe by design

Homebrew cleanup is lower risk than deleting Cellar directories by hand because it uses version and dependency metadata. It can still remove a rollback version or a cached bottle you expected to use offline. Preview both cleanup and autoremove, and keep pinned or operationally critical versions intentionally.

Under the hood: the Cellar, the Caskroom, and how cleanup decides

Homebrew installs each formula into a versioned directory in the Cellar reported by brew --cellar, then links the active version into its prefix. Upgrading places the new version alongside the old before repointing the symlinks. Casks keep versioned metadata under the Caskroom while their app bundles commonly live in /Applications. Downloads use the path reported by brew --cache and are retained according to Homebrew's policy. brew cleanup uses installed-version and retention metadata rather than simply deleting every non-current directory, while brew autoremove reads the dependency graph to find formulae installed only to support something now gone. Because it acts on version metadata and the dependency graph rather than guessing, it is safer and more explainable than manual folder removal. A preview is still useful on machines that depend on old toolchains or offline bottles.

The Homebrew Cellar holds an old and a current version of a formula with the bin symlink on the current one; cleanup removes the superseded version and old cached downloads.
Homebrew tracks versioned Cellar entries, active links, and cached downloads. Cleanup uses that metadata to choose superseded artifacts.

Where another tool should stop

A disk map or cleaner can reveal the Homebrew cache and show its size. Mole can surface that category, but Homebrew's own commands remain authoritative for Cellar versions and dependency relationships. Discovery and ownership should not be confused.

A safe order of operations

Use Homebrew's path commands to measure its stores, preview brew cleanup -n, and run ordinary cleanup before considering -s. Preview brew autoremove separately because it answers a dependency question, not a cache question. There is no need for a fixed cleanup schedule when automatic cleanup is working and disk pressure is low.

Mole brings disk analysis, app maintenance, and review-first cleanup into one native app, while leaving system-owned data to macOS and the apps that own it.

Buy Mole Try it free

Keep reading

  • DeveloperClean Up Ollama and LM Studio Models on Mac4 min read
  • DeveloperClean Up Xcode Without Losing Release Artifacts3 min read
  • DeveloperClean Up Docker on Mac Without Losing Data3 min read

Mole · 鼴

Cleanup, software, and status for your Mac.

v1.11.0 · Release notes

Support

Help Documentation Releases

Legal

Terms of Service Privacy Policy Refund Policy

Resources

Blog CLI Tool Affiliates Program

Connect

Twitter hi@mole.fit

Only official site mole.fit · Fake sites may ship unsafe downloads

For your Mac, or a friend's. The CLI stays free for terminal workflows. May your time be your own.