When you install Homebrew on your Mac as a package manager, you will experiment by installing several packages that you find useful.
But what happens when you don’t need a specific Homebrew package is that it is just taking up the space. So, you can uninstall packages with Homebrew with a simple command to make some space and clean up the computer.
Removing packages with Homebrew is easy. In fact, uninstalling and deleting packages from Homebrew is as simple as installing a package.
Table Of Contents
How to Uninstall Packages with Homebrew
Here is how you can uninstall packages with Homebrew that you previously installed.
1. Press command + spacebar on your keyboard to open the spotlight search.
2. Search for Terminal and open the first result.
3. Type in the following command followed by Homebrew package name.
Here wget is the package name so you can replace it with the one you want to uninstall.
brew uninstall wget
So, the homebrew package is removed, but some of the files still remain. Now, we will remove them.
4. First, let us list the remaining files with the following command and press enter.
brew list
Then, you will see the remaining files as you can see in the image above.
5. After that, type the following command and press enter.
brew autoremove
This will remove all the remaining homebrew package dependencies and provide you with more space on the Mac PC.
Now, if you want to go overboard and remove outdated formulas and caskets, then use the following command.
brew cleanup -s
Uninstall Package with Homebrew without removing dependences
Sometimes, dependencies are used by multiple packages. So, removing them will make the other package unusable. Use this command instead while uninstalling to ignore the dependencies.
It ignores dependencies with the Homebrew package, which are in use by other packages. | brew uninstall –ignore—dependencies package name |
Find out the dependencies with the package before uninstalling them | brew deps package name |
Also Read – Remove DNS cache on macOS
Remove Packages with Homebrew
So this is how you can uninstall packages with Homebrew. You can remove it using the uninstall command and be done with the process.
But if you want to remove every related file and cache, then do remember to use the autoremove command.