brew-cleanup
Remove outdated downloads and old package versions
TLDR
SYNOPSIS
brew cleanup [options] [formula|cask]
DESCRIPTION
brew cleanup removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. It cleans the Cellar and the download cache, freeing disk space.By default, downloads older than 120 days are removed. This threshold can be changed with HOMEBREWCLEANUPMAXAGEDAYS.Homebrew automatically performs cleanup after upgrades and periodically every 30 days unless HOMEBREWNOINSTALL_CLEANUP is set.
PARAMETERS
--dry-run, -n
Show what would be removed without removing--prune days
Remove all cache files older than specified days. Use --prune=all to remove everything-s, --scrub
Scrub the cache, including downloads for even the latest versions--prune-prefix
Only prune the symlinks and directories from the prefix, removing no other files--formula
Treat all arguments as formulae--cask
Treat all arguments as casks
CACHE LOCATION
Default cache location: ~/Library/Caches/Homebrew (macOS)View cache path: brew --cache
RELATED COMMANDS
brew autoremove
Remove unused dependenciesbrew upgrade
Should be followed by cleanup
CAVEATS
Old versions are automatically removed during brew upgrade. The -s flag removes even current version downloads which may need re-downloading later. Running without arguments cleans all installed packages.
SEE ALSO
brew(1), brew-upgrade(1), brew-autoremove(1)
