Brew Uninstall Package

Last Updated On 2023-04-07

The short answer

To remove a package with Homebrew, you can start by listing all the packages currently installed on your system and managed by Homebrew using the [.inline-code]brew list[.inline-code] command, then run the following [.inline-code]brew uninstall[.inline-code] command:

 $ brew uninstall [package …]


  • [.inline-code]package …[.inline-code] is the name of the package(s) you want to remove.

When executing this command, you will be prompted to confirm whether you want to remove that package, to which you can type [.inline-code]y[.inline-code] and press [.inline-code]ENTER[.inline-code] to confirm.

Alternatively, you can use the [.inline-code]--formula[.inline-code] flag to remove CLI packages only:

 $ brew uninstall --formula [package …]

Or the [.inline-code]--cask[.inline-code] flag to remove GUI packages only:

 $ brew uninstall --cask [package …]

Note that [.inline-code]brew remove[.inline-code] and [.inline-code]brew rm[.inline-code] are both aliases of the [.inline-code]brew uninstall[.inline-code] command and will have the exact same effect. If you want to learn more about the [.inline-code]brew list[.inline-code] command, you can read our post on how to list installed packages with Homebrew.

[#uninstall-specific-packages][.inline-code]brew[.inline-code] uninstall specific packages like [.inline-code]node[.inline-code], [.inline-code]python[.inline-code], etc.[#uninstall-specific-packages]

If you’re using Warp as your terminal, you can easily retrieve commands to remove common packages such as [.inline-code]mysql[.inline-code], [.inline-code]postgres[.inline-code], [.inline-code]go[.inline-code], or [.inline-code]docker[.inline-code] using the Warp AI Command Search feature:

Entering [.inline-code]remove python with brew[.inline-code] in the AI Command Search prompt results in [.inline-code]brew uninstall python[.inline-code], which you can then quickly insert into your shell by doing [.inline-code]CMD+ENTER[.inline-code].

[#remove-unused]Remove unused dependencies[#remove-unused]

Packages often require one or more other packages (i.e. dependencies) to function properly. When installing a package with Homebrew, its dependencies are automatically installed with it. However, when removing a package, only the specified package is removed but not its dependencies, as they may also be used by other locally installed packages.

To free up disk space and remove the dependencies that are no longer required by any package, you can use the following command:

 $ brew autoremove [--dry-run]

Note that to list the dependencies that would be removed without actually removing them, you can use the [.inline-code]--dry-run[.inline-code] flag.

[#outdated-versions-residuals]Remove outdated versions and residual files[#outdated-versions-residuals]

To free up even more space, you can remove stale lock files, symbolic links, and outdated package versions using the following command:

 $ brew cleanup [--dry-run]

Note that, by default, this command will remove all downloads that are older than 120 days, which can be changed using the [.inline-code]HOMEBREW_CLEANUP_MAX_AGE[.inline-code] environment variable.

[#uninstall-all][.inline-code]brew[.inline-code] uninstall all packages at once[#uninstall-all]

To remove all the packages previously installed with Homebrew at once, you can use a combination of the [.inline-code]brew uninstall[.inline-code] and the [.inline-code]brew list[.inline-code] commands as follows:

 $ brew uninstall --force $(brew list)


  • The [.inline-code]--force[.inline-code] flag is used to remove packages without prompting for confirmation.
  • The [.inline-code]$(brew list)[.inline-code] expression will be replaced by the list of currently installed packages.

Note that this command will also remove any dependencies that were installed alongside the packages you are removing, which means that anything previously installed with Homebrew will be completely removed from your system.

[#beware-only-homebrew]Beware that you can’t [.inline-code]brew[.inline-code] uninstall packages that weren’t installed with Homebrew[#beware-only-homebrew]

The packages installed with Homebrew are added to the Homebrew database and are kept in separate directories from the ones used by the operating system.

When using the [.inline-code]brew uninstall[.inline-code] command, Homebrew checks its own database to locate the package you want to uninstall, and removes it along with any files associated with it.

If you try to remove a package that is not managed by Homebrew, it won't be able to find the package information in its database, and therefore won't be able to uninstall it.

To remove a package that was not installed with Homebrew, you'll need to use a different method, such as manual removal.