Reclaim Disk Space with brew cleanup

brew cleanup removes old version kegs and cached downloads; -s also scrubs the download cache, --prune=all removes everything cached.

macOScleanupbrewdiskLow risk
Run `brew cleanup -s` to delete stale versions and cached downloads, or `brew cleanup --prune=all` for a full cache wipe.

01Command

Command
$ brew cleanup -s && brew cleanup --prune=all

02What it does

Homebrew quietly keeps old kegs for 120 days so you can roll back, and every .tar.gz it downloads stays in the cache — on active machines this accumulates to several gigabytes. Preview the damage with `brew cleanup -ns` (dry run) before committing. Cleanup runs automatically after some brew commands on newer versions, but an explicit periodic `brew cleanup -s` is still worth scheduling on CI and build machines.

03Risk

RiskLow risk
RequirementsHomebrew (https://brew.sh)
!Warning: --prune=all removes cached installers too — reinstalling a formula afterward will re-download it.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Homebrew Man Page
    Homebrew · vendor-doc · 2026-09-17
    Evidence: Documents brew cleanup (--scrub/-s to clear cache, --prune=all to remove all cached downloads) and the default 120-day retention.

Last verified: 2026-09-17 · Category: Developer

06Related solutions