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 Ventura, MacOS Monterey, 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.sh)"
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:
https://raw.githubusercontent.com/Homebrew/install/master/uninstall
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:
./uninstall --help
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.
But how to you uninstall it from Sonoma??
hi when trying to download home brew not able to download not sure why when I am typing brew run keep giving me error file not found. please can anyone help me for this.
The direct download link in Option 2 returns a 404 error because it’s missing `.sh` at the end.
Fixed, thanks for the heads up. HomeBrew has occasionally updated the filename of the uninstall (and install) scripts.
yowzers, I tried this but now my Home folder is missing !
Both the terminal command and the download don’t work. It keeps saying “Failed to locate Homebrew!”. What can I do about this?
hi when trying to download home brew not able to download not sure why when I am typing brew run keep giving me error file not found. please can anyone help me for this.
Too late for your article to serve as a guide uninstalling Homebrew. I wanted to run another utility that required newer Ruby version installation that in turn required Homebrew. Since I’m on a very old OS the install failed with a warning so I had to retreat. The good thing was that during installation it displayed all the details on the screen of Terminal including directories to be created and files to be installed in them. I actually was able to “dig out” pretty easily these folders and check they were newcomers by entering Time Machine.
Homebrew creates a new directory which path is “/usr/local”. It puts all its dependencies, files and subdirectories there. Granted since in my case installation was broken it might haven’t completed and halted half-way so there theoretically may be other components but as far as I was able to trace it Homebrew installs only one new directory – /usr/local which is a subdirectory of existing /usr which you shouldn’t touch.