brew Verified current stable Not installed? Package Management

Brew / Remove Unused Formulae

Remove Unused Formulae

Automatically remove all unused formulae from Homebrew installations.

$
Terminal
brew autoremove

When To Use

When cleaning up a development environment to free resources and maintain package hygiene.

Pro Tip

Add '--force' to bypass confirmation prompts, but use with caution to avoid accidental data loss.

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
Removing unused formulae...

==> Uninstalling:
   package1  1.0.0  -->  removed
   package2  2.3.0  -->  removed

==> 2 packages removed.

Anatomy of Output

Understanding the result

Removing unused formulae: 5 items. Removal Summary

Indicates the number of packages identified for removal.

Deleted: pkg-config Deleted Package

Lists specific packages that were removed.

Cleanup complete: 20MB reclaimed. Cleanup Status

Shows the amount of disk space freed by the operation.

Power User Variants

Optimized versions

brew autoremove --dry-run

Preview actions without executing removals.

brew autoremove --force

Remove unused formulae without additional confirmation.

Troubleshooting

Common pitfalls

Error: No unused formulae to remove

Solution: Run 'brew list' to verify existing installations.

Failed to remove some formulae - Permissions error

Solution: Run the command with sudo if permissions are lacking.

No such formula: pkg-name

Solution: Ensure the formula exists before attempting removal.

Command Breakdown

What each part is doing

brew
Base Command
The executable that performs this operation. Here it runs Brew before the shell applies any redirect operators.

How To Run

Execution path

  1. Step 1

    Run the command: `brew autoremove` to remove unused formulae.

  2. Step 2

    Verify the removal with: `brew list` to see the current installed packages.

Alternative Approaches

Comparable commands in other tools

Alternative package management tools for the same job.