Homebrew is a command-line tool that is used to install Unix tools that are not provided by Apple. Homebrew provides an easy and flexible way to install 3rd party packages. Homebrew is very similar to the Linux counterparts apt and yum commands. In this tutorial, we will learn how to uninstall the homebrew from the MacOSX completely and remove it from Mac.
Uninstall/Remove Homebrew From MacOSX
There are different ways to uninstall or remove the homebrew package management tool from the MacOSX. While saying MacOSX it can be different versions of the Apple laptop and desktop computers which are also called Mac or MacOS. In order to remove or uninstall the homebrew, we can use the ruby and bash commands. The uninstall or remove script on the homebrew is provided on its own and can be downloaded from the GitHub repository. But we will use the curl command from the command line interface in order to download it automatically and easily and then run with bash or ruby.
Uninstall/Remove Homebrew For MacOS Catalina, MacOS Big Sur, MacOS Majove
For the latest version of the MacOSX operating systems where the X can be Catalina, Big Sur, or Majove the Bash script is provided for uninstallation or removal. Just use the following command which first downloads the bash script file and then executed it with bash interpreter.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
Uninstall/Remove Homebrew For MacOS High Sierra, MacOS Sierra, MacOS El Capitan and earlier MacOS Versions
If you are using the MacOS High Sierra and previous versions like MacOS Sierra, MacOS El Capitan, and earlier versions you should use a Ruby script which is similar to the bash script. Just use the following command which will download the uninstall ruby script and execute with the Ruby interpreter.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Uninstall/Remove Homebrew with Uninstall Script Manually
In previous examples, we have downloaded the uninstallation script automatically with the curl command-line tool and then execute them with the related interpreters of the related scripting language like Bash or Ruby. Also, the uninstallation script is provided like a command-line tool that can detect the version of the MacOS and executed the related script with the name of uninstalling. First, navigate the following URL which provides the uninstall script. Download or save this script with a name whatever you want which can be uninstalled.
Now the file is saved with the name of uninstalling. Open the terminal command-line interface and navigate to the saved script path. Now we will use the following command in order to list help information about uninstallation or removal of the Homebrew.
List What Will Be Removed with Uninstall
Uninstall will remove different files and directories which range from “~/Library/Caches/Homebrew“, “~/Library/Logs/Homebrew” etc. But this may create a problem if some unwanted directory or file is removed. We can simulate the uninstall process with a dry run which is specified with the –dry-run option like below.