How to Uninstall Homebrew from Mac OS
If you have previously installed Homebrew to a Mac and have now decided that you no longer need or want the command line package manager, you can uninstall Homebrew from MacOS and completely remove Homebrew and all installed packages and formula from the Mac.
This tutorial will walk through how to completely uninstall Homebrew from a Mac, meaning it will remove the entire package manager itself, along with removing the brew and cask commands, along with the various software packages that may have been installed. Notably, this is completely different from simply uninstalling individual packages with Homebrew, which is how you’d remove a particular formula from the package manager.
How to Uninstall & Remove Homebrew in Mac OS
There are a few ways to uninstall Homebrew and remove it from a Mac. Perhaps the simplest method is using a single command string entered into the Terminal, just as you run a ruby and curl command in the command line to install Homebrew, you also run a ruby and curl command to uninstall Homebrew from a Mac.
The single command to uninstall Homebrew is as follows, depending on your version of MacOS:
For uninstalling Homebrew in MacOS Catalina, macOS Big Sur, and MacOS Mojave:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
For uninstalling Homebrew from MacOS High Sierra, Sierra, El Capitan, and earlier:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
This uses ruby to execute the Homebrew uninstall script that is downloaded from github with the curl command. When executed properly, the uninstall script will run on the Mac and completely remove Homebrew.
Option 2: Uninstalling Homebrew with the Uninstall Script Manually
If you don’t like the idea of executing a script downloaded from the internet with curl (which is understandable for security conscious individuals), then you can also view, download, and review the uninstall script beforehand, and then execute it manually on the computer that you wish to remove Homebrew from.
The Homebrew uninstall script is located at the following URL:
Save that file as a text document labeled “uninstall” or “uninstallhomebrew” or whatever you want to call it, and then execute the command as usual. Alternatively, you can run the uninstall script with –help flag to get more details and options:
Whether you use either method outlined above, Homebrew will be uninstalled. This will also remove any packages with it, but if you only want to uninstall certain formula and packages rather than Homebrew entirely you should instead focus on these instructions.
The last option, which we’re not going to cover here due to complexity and variability of each users configuration and what packages they have installed, is to manually delete all Homebrew directories, dependencies, formula, and all related files from the wide-ranging Homebrew directory locations, including removing every individual item in the Homebrew installed package location of the Mac. That’s a much more time consuming process, and you’ll be digging around in a variety of system level directories. This method is inappropriate for the vast majority of users – advanced or otherwise – and thus will not be covered. But if you’re curious, use the find, locate, and mdfind commands to discover all Homebrew, brew, cask, and Cellar related data on the Mac.
That’s about it, assuming you ran the Homebrew uninstall scripts the process is pretty straight forward and the removal is complete. Of course if you need and use Homebrew there is no reason to uninstall it, but if you happened to install Homebrew and later discovered it’s of no use to you, it’s perhaps relevant to remove it from your Mac.