Homebrew is an open-source and free software package management system for Mac OS X and Linux. Although it is not pre-installed on every macOS device, it is a third-party addon that users didn’t realize they needed until they used it.
Users trying to install Homebrew sometimes face an error “brew: command not found.” This article will talk about all the possible solutions to eliminate this error and install Homebrew successfully on your laptop. Prior to it, let us first discuss what Homebrew is and how to install the one on your Mac systems.
Contents
What is Homebrew?

Homebrew makers perfectly define it as ” used for installing the items you need that Apple didn’t provide.” It is a free and open-source package manager for macOS that allows you to install, update, remove, and manage developer tools, such as Python, Ruby, and Node.js on your Mac.
What does Homebrew do?
You may use Homebrew to access a plethora of command line programs for automating your work. The best part is that they are all installed, uninstalled, and updated in a single area on your Mac.
Here are a few examples of handy features accessible through Homebrew:
- Imagemick- Used to convert images between different formats.
- Archey- For sharing localhost with team members.
- Hub- Simplifying and advancing the experience with Git.
- Tldr- For getting practical examples on how to use the command line.
How to Install Homebrew on Mac?
Installing Homebrew Mac requires the usage of curl to get the installation script. The Homebrew team recommends this method as it is the quickest and simplest. The same holds true for deleting Homebrew. However, you can go with manual download and execute the script if you don’t want to utilize curl for security reasons.
Before you begin, ensure that your macOS meets the following prerequisites:
- Apple Silicon or 64-bit CPU
- macOS 10.14 or more updated version
- Bourne-compatible shell (bash or zsh syntax)
- Command line tools for Xcode
Step 1: Setting up Xcode’s command line tools
Xcode is Apple’s native IDE that includes all of the tools needed for Mac computer programming. To install some of the Homebrew package components, you must first install Xcode’s command line tools (if you haven’t already). Here’s how to do it:
- Open Terminal and enter the following command:
xcode-select - - install
- Confirm that you want to install the Xcode tools in the new dialogue window.
- Accept the license agreement and allow time for the installation to finish. It could take some time.
Step 2: Install Homebrew on Mac
The installation process is as follows:
- Type the following command in Terminal to install Homebrew automatically:
/bin/bash-c"$(curl-fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The above command is to install Homebrew on macOS Catalina, macOS Mojave, and macOS Big Sur.
Run the following command to install Homebrew for macOS High Sierra, Sierra, El Capitan, and earlier.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Enter the admin password (your keystrokes won’t be visible in the Terminal window because of security reasons) > hit Return
- The “Installation successful” message should appear in the Terminal after a few minutes.
Step 3: Set up Homebrew
To begin, type brew help into Terminal. You’ll see a list of commands that will assist you in installing various software, configurations, and updates using Homebrew. To install a package, for example, type brew install ‘package name’ in Terminal. You should also be aware of a few useful troubleshooting commands, such as brew doctor, which can detect installation issues.
Step 4: Update Mac Homebrew
Anything you install with Homebrew must always be updated on a regular basis. You should also update the package manager on a regular basis to ensure that it is functioning properly and you are not missing any new features:
- Run brew update in Terminal to update Homebrew.
- Run brew outdated in Terminal to see which packages need to be updated.
- In Terminal, type brew update ‘package name’ to update a particular package.
Fixing “zsh: command not found: brew”?
If you get the “brew: command not found” error, it means that the brew executable binary is not available within the directories specified in your PATH environment variable.
Environment variables are system variables that are available to all processes and users running the operating system (OS), such as Windows, macOS, and Linux. Environment variables, for example, can be utilized to store values across the entire system.
The most popular environment variable is PATH. It keeps track of the directories that are searched for executable files.
Reinstall Homebrew
When software does not work as expected, reinstalling it from the ground – up may be the best option. So, if you receive a brew command not found after install, you can try out reinstalling Homebrew.
To uninstall Homebrew properly, we must use its authorized script by opening a Terminal window and running it.
/bin/bash-c"$(curl-fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Once the uninstallation process is completed, go to the official Homebrew website and cautiously copy and paste the one-line configuration command into Terminal.
/bin/bash-c"$(curl-fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you’re curious to know why the command includes ‘/bin/bash’ rather than ruby, it’s because the Homebrew installer was recently rewritten in Bash to ensure better compatibility.
Add brew to PATH
The Homebrew installer adds brew to PATH instantly, but the process can be interrupted, resulting in “brew: command not found.”
As a result, if the brew environment variable is not set, the following steps must be taken:
- Execute the following command to configure your Mac’s environment variable.
echo'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
In some cases, you may need to replace export PATH=”/usr/local/bin:$PATH” with export PATH=$PATH:/opt/homebrew/bin
- We must now put the changes into effect. To activate and try drew doctor again, enter the following command:
source .bash_profile
Alternatively, if you have already designed the environment variable, you can use the following command to verify that it is correct:
/usr/bin/open ~/.bash_profile
Homebrew on Apple M1/Apple Silicon Devices

If you have a new Mac with an Apple M1 processor, the Homebrew installer may prompt you to add brew to the zsh configuration file named .zprofile.
The reason behind this is that the ARM version of Homebrew should be placed in /opt/homebrew rather than the standard /usr/local/homebrew.
- To install Homebrew on Apple M1, use the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installing, if you get zsh: command not found: brew mac, it implies that you need to add brew to PATH.
- To add Homebrew to PATH in /Users/668/.zprofile, use the following command:
echo'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile
After entering the above command on the Terminal, hit return, and again enter the following command:
eval $(/opt/homebrew/bin/brew shellenv)
Conclusion
If you want to increase your productivity and accomplish more with your Mac, command-line package management is a must-have. Homebrew is one of the best free package managers, and it’s relatively simple to use if you’ve used Terminal before.
This article covered everything about the most common error Mac users receive: brew command not found. It covered how to reinstall Homebrew and add brew to PATH. In addition, it also discussed how to fix the brew command not found on mac M1.
Frequently Asked Questions
- Why is brew not found on Mac?
As previously stated, one of the most common causes of the ‘command not found brew’ error on Mac is the executable brew directory not being present in the ‘PATH’ environment.
- How do I know if Homebrew is installed on my Mac?
After installing Homebrew, launch the terminal and enter the command brew doctor.
- If you receive the message: Your system is ready to brew. Then you’re all set and have successfully installed homebrew.
- If you receive any warnings, try resolving them.
- How do I know if XCode is installed on my Mac?
Use the Finder to see if XCode is already installed. Select Applications from the Go pull-down menu in Finder. Alternatively, while the Finder is open, press Command-Shift-A. This should launch a new Finder window displaying all of the Applications installed on your computer.

Sameeksha is a freelance content writer for more than half and a year. She has a hunger to explore and learn new things. She possesses a bachelor’s degree in Computer Science.