Homebrew is a free and open-source software package manager that simplifies software installation on macOS.
It allows you to install various packages from source or binary distributions by compiling them yourself or using precompiled binaries.
Homebrew also provides a convenient way to manage your software dependencies and makes it easy to uninstall software you no longer need.
It lets you install the stuff that didn’t come out of the box with your Mac. It works the same way as apt-get
on Debian/Ubuntu system or yum
on CentOS/Red Hat.
You can install almost all the Linux libs and tools on your Mac. Not only that, but you can also create your own packages to install on other Mac systems.
It has pure Git and Ruby underneath, so hack away with your knowledge and creativity.
Fix -bash: brew: command not found
If you got this error while brewing a package on your Mac, then you are not alone. The reason is simple. Homebrew is not installed on your system.
To fix that, we’ll see how to install Homebrew.
But first, let’s check the requirements for Homebrew and make sure they are all met.
Homebrew Requirements for macOS
- A 64-bit Intel CPU or Apple Silicon CPU
- macOS Catalina (10.15) (or higher)
- Command Line Tools (CLT) for Xcode
- The Bourne-again shell for installation (i.e.
bash
)
Homebrew installation command will take care of installing bash
as its dependency.
We just have to manually install Xcode Command Line Tools.
So let’s start the installation process.
Install Homebrew on Mac
Step 1. Install Command Line Tools for Xcode
Open Terminal and run the following command:
xcode-select --install
It should show this prompt:
It might take some time, depending on your connection speed.
Once done, it should show a confirmation saying “The software was installed”
You can now proceed to the next step.
Step 2. Install Homebrew
You can install Homebrew on Mac by running the following command into the terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This script will install Homebrew to /usr/local
on your Mac. That way, you won’t need sudo
when you use brew install
.
Uninstall Homebrew from Mac
Execute this single command given below in the terminal to completely remove Homebrew from Mac automatically:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"