https://ralphjsmit.com/uninstall-homebrew
INSTALL HOMEBREW
Homebrew is a great way to manage packages on macOS. Arguably it is one of the best package managers out there, because it's simple to use and offers thousands – if not more – packages with just a few simple commands. In this guide I'll show you how to install Homebrew on macOS, so that you can get up and running immediately.
Homebrew is an app that works via the terminal. That means that there isn't a native 'regular' UI like you would expect (checkout Cakebrew if you do need one). Installing Homebrew can be daunting if you do it for the first time, but, in fact, it's nothing more than running a few commands in the right order.
Installing Xcode command line tools
In order to install Homebrew, you need the Xcode command line tools installed. If you've never made use of the terminal yet on your Mac, chances are that this need to be installed. Paste the following command in the terminal to install them:
xcode-select --install
If the command line tools are not yet installed, a popup will appear, asking you for permission to install the tools. Click Install and wait till the installation is finished.
If the tools are already installed, the terminal will display a message that it is already installed and that updates come the Software Updates.
Install Homebrew on MacOS
To install Homebrew, open up the terminal and paste the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This command will start the installation for you. Enter your password to start the process (if asked). The installation will continue automatically. The installation is successful if you see something like this:
From https://github.com/Homebrew/homebrew-core
* [new branch] master -> origin/master
HEAD is now at 7fb6354a2a pandoc-crossref: update 0.3.11.0 bottle.
Warning: /opt/homebrew/bin is not in your PATH.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics data has been sent yet (or will be during this `install` run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Add Homebrew to your PATH in /Users/ralphjsmit/.zprofile:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ralphjsmit/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Run `brew help` to get started
- Further documentation:
https://docs.brew.sh
Final steps: put /opt/homebrew/bin in your $PATH
After Homebrew is installed, you'll still need to take a few final steps. The first step is to put a specific path in your $PATH
. You do not need to know why this is, but Homebrew will provide you with two commands that will do the trick:
==> Next steps:
- Add Homebrew to your PATH in /Users/ralphjsmit/.zprofile:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ralphjsmit/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Copy the two commands from your terminal (they're a slightly different for each computer), paste them and hit enter. Note that the first command starts with echo...
up to .../.zprofile
and the second is eval " ... shellenv)"
.
Disabling analytics (optional)
The last step I usually take is disabling analytics. Homebrew uses Google Analytics to send 'anonymous aggregate user behaviour analytics' to them. This allows them to prioritize bugfixes and check which OS version people are using (useful for development).
You're free to enable or disable Homebrew analytics. It will not impact your experience. Opting out (forever) can be done by running:
brew analytics off
UNINSTALL HOMEBREW
Homebrew is a great tool to manage packages on macOS. However, there might come a moment that you want to fully uninstall it. Perhaps you need to do a clean install again or there is an other reason. Anyway, uninstalling Homebrew is not difficult. In this tutorial, I'll show you how to uninstall Homebrew.
Uninstalling Homebrew is very similar to the way it is installed. Open up your terminal and paste the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
This script will show you what it will delete and ask you if you want to continue uninstalling Homebrew. Type 'y' to continue the uninstall.
Note: please be aware that this also uninstalls every package you installed. You can't uninstall Homebrew and keep the packages.
If the script asks you for your password, enter it. Sometimes it needs additional permissions to access certain directories.
Removing additional directories
At the end of the uninstall, Brew will give you a message like this:
The following possible Homebrew files were not deleted.
/opt/homebrew/...
/opt/homebrew/...
/opt/homebrew/...
...
You may wish to remove them yourself.
The following possible Homebrew files were not deleted:
/usr/local/Frameworks/
/usr/local/Homebrew/
/usr/local/MacGPG2/
/usr/local/bin/
/usr/local/etc/
/usr/local/include/
/usr/local/lib/
/usr/local/opt/
/usr/local/sbin/
/usr/local/share/
/usr/local/var/
You may wish to remove them yourself.
There are two options for the file paths:
- Apple Silicon Macs – if you're using a Mac with a chip from Apple (like the Apple M1), each path will look like this:
/opt/homebrew/additional/path/here
. - Intel Macs – if you're using a Mac with an Intel-chip, each path will look like this:
/usr/local/additional/path/here
.
This doesn't matter. What does matter, though, is that you delete them. Open Finder, go to the folders mentioned (normally they're all in the same folder), and delete them.