brew-autoremove
Remove unneeded Homebrew dependencies
TLDR
Remove all unused formulae
Print what would be removed, but don't actually remove anything
SYNOPSIS
brew autoremove [--dry-run] [--ignore-dependencies] [-i, --ignore-missing-formulae] [--quiet] [-d, --debug] [--help] [--version]
PARAMETERS
--dry-run
Preview removals without deleting anything.
--ignore-dependencies
Proceed even if uninstall dependencies remain installed.
-i, --ignore-missing-formulae
Skip failure if target formulae aren't installed.
--quiet
Suppress non-error output for cleaner logs.
-d, --debug
Output verbose debug information.
--help
Show command help and exit.
--version
Display Homebrew version.
DESCRIPTION
The brew autoremove command cleans up Homebrew installations on macOS and Linux by removing locally installed formulae and casks that are no longer dependencies of any currently linked packages. It targets 'leaf' nodes in the dependency graph—formulae installed solely as dependencies but orphaned after uninstalling parent packages.
This differs from brew cleanup, which only deletes old versions of upgraded formulae. Autoremove frees significant disk space, especially after heavy usage or upgrades, by also handling keg-only and unlinked formulae. It scans the entire Cellar, identifying and uninstalling unused items safely.
Ideal for maintenance, it mimics package managers like APT's autoremove, promoting a tidy environment without manual tracking of dependencies. Run periodically to optimize storage and reduce clutter in Linuxbrew setups.
CAVEATS
Use --dry-run first to review changes; irreversible deletions occur otherwise. Only affects Homebrew Cellar—won't touch system packages or externals. Incompatible with pinned formulae.
USAGE TIP
Combine with brew cleanup for full cleanup: brew autoremove && brew cleanup.
LINUX NOTE
Fully supported in Linuxbrew; run as non-root to avoid permission issues.
HISTORY
Added in Homebrew 2.5.0 (January 2021) to replicate apt autoremove functionality. Evolved from user requests for automated dependency cleanup, now standard for Linuxbrew maintenance.
SEE ALSO
brew cleanup(1), brew uninstall(1), apt autoremove(8), dnf autoremove(8)


