If you have installed Homebrew on a Mac to use as a package manager for many Unix and command-line utilities. Then you’ve probably also installed a handful of packages deemed that is useful to you. But what if you no longer need one, and you want to uninstall a particular Homebrew package? In this article, we are going to talk about Brew Uninstall – How to Uninstall Packages.
It turns out that uninstalling packages/formula along with Homebrew is very easy. In order to be clear, we’re not talking about uninstalling Homebrew itself, we’re just talking about removing specific packages from Homebrew.
Uninstall and Remove Homebrew Packages
The proper way to remove a Homebrew package is with the uninstall or remove command actually.
The uninstall Homebrew package command actually looks like this:
brew uninstall packageName
And the remove Homebrew package command looks like this:
brew remove packageName
As you may have know now, that the remove and uninstall commands are exactly the same and get the same result. The removal of the Homebrew package.
Such as, to remove and uninstall Telnet (assume that you installed telnet on the Mac with Homebrew anyway). Then you would use the following command string:
brew uninstall telnet
Or you can also use the remove command for the same effect:
brew remove telnet
Removing a package from Homebrew is quick because there is no need to download anything. It just removes the Homebrew package from the Mac.
You can also confirm the package was removed through trying to run the command again. Or through checking where Homebrew packages are installed to and you will find the package you removed is no longer there.
Homebrew Package Uninstall Other Options | brew uninstall
There are actually two flags that you can pass to the Homebrew uninstall command as well. That is force and ignore dependencies.
The –force flag (or -f) will forcibly remove the package along with deleting all the versions of that package/formula.
The –ignore-dependencies flag does just what it sounds like, it will actually ignore dependencies for the formula in question when uninstalling the designated package.
Manage Dependencies when Uninstalling Homebrew Packages | brew uninstall
One thing to keep in mind that when removing and uninstalling packages from Homebrew, if the package is uninstalled has dependencies. That is in use by another package or formula, then that may break it causing the secondary package to no longer work correctly actually. Perhaps the simplest way to avoid that is to use the optional –ignore-dependencies flag. Such as:
brew uninstall --ignore-dependencies telnet
If you are not sure what dependencies exist with a specific Homebrew package. Then you can use the deps command to find that out:
brew deps packageName
Such as if you installed python3 on the Mac using the Homebrew approach. That has a fair amount of dependencies, running that command would look something like the following:
% brew deps python3
Since many other packages also use those dependencies, if you were to remove python3 you’d almost certainly want to issue the –ignore-dependencies flag as well. The same applies to node.js and npm, and also many other popular Homebrew packages.
Alright, That was all Folks! I hope you guys like this brew uninstall article and also find it helpful to you. Give us your feedback on it. Also if you guys have further queries related to this article. Then let us know in the comments section below. We will get back to you shortly.
Have a Great Day!