Many Mac users encounter the “brew command not found” error when running a brew command on their MacOS terminal. If you are currently experiencing this issue, don’t panic. It doesn’t mean there is an issue with your Mac. You just need to perform some actions.
Read this article to discover the working solutions you can try to fix the “brew: command not found” error.
The “brew command not found” is an error that occurs when you run a brew command on the wrong file path in your Mac. In other words, you may encounter the “brew command not found” error when your system cannot find the brew binary in its PATH environment.
Consider the explanation below for more clarity.
Generally, Unix systems usually hold directories where they check for the binaries of a command. Hence, the system usually checks its directories for a binary that matches the name of commands you run from your terminal.
If the system cannot find a matching binary, you will get the “command not found” error.
In this case, your system will search the list of directories in your PATH environment variable. If it doesn’t find the brew binary, it will return the “brew command not found” error.
In this section, we’ll talk about some fixes you can try to solve the “brew command not found” issue. Try them to see which works for you.
When software isn’t running as it should, it is often a good idea to uninstall and reinstall. You can do the same with your Homebrew software.
Note that if you want to uninstall the Homebrew software completely, you will need to run an official uninstall script in your Mac terminal. Follow the steps below for guidance:
- STEP 1: Open the terminal on your Mac
- STEP 2: Enter the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
If you are in doubt, the command above is the official command recommended by the developers of Homebrew on Github.
- STEP 3: Restart your system after uninstalling the Homebrew software completely.
- STEP 4: Go to the Homebrew official website.
- STEP 5: Copy the installation command below and paste it into your terminal.
/bin/bash -c "$(curl -fsSL "
Note that the Homebrew installer has recently been rewritten in Bash; that is why the command includes /bin/bash instead of ruby.
Most times, the Homebrew installer usually adds brew to PATH automatically. However, an interruption can occur during the process.
If your system couldn’t configure the brew environment variable, follow the steps below to avoid the “brew command not found” error.
- STEP 1: First run the command below to set up your Mac’s environment variable
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
Depending on the location you installed brew to, you might have to replace export PATH=”/usr/local/bin:$PATH” with export PATH=$PATH:/opt/homebrew/bin
- STEP 2: Activate the changes by typing the command below
If you are using a new Mac that runs on the Apple M1 processor, the Homebrew installer may tell you to add brew to zsh configuration file. The zsh configuration is usually with the name “.zprofile.”
You will need to install the ARM version of the Homebrew in “/opt/homebrew” instead of the regular “/usr/local/homebrew.”
- You can use the code below to install the ARM version of Homebrew on your M1 device:
666@XXX-MacBook-Pro ~ % /bin/bash -c "$(curl -fsSL "
==> Next steps:
– Add Homebrew to your PATH in /Users/668/.zprofile:
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/668/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)
– Run `brew help` to get started
– Further documentation: https://docs.brew.sh/
666@XXX-MacBook-Pro ~ % brew install –cask google-chrome zsh: command not found: brew
- The lines of code below also work for some people:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- You can also use the command below to add the brew to .zshrc:
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> $HOME/.zshrc
Most users have noticed that the Homebrew software did not run because they had not installed Xcode on their system. Follow the process below to install Xcode on your system.
- STEP 1: First, run the code below to check if you have already installed Xcode on your system or not.
- STEP 2: If it prints out something like this:
“Xcode 12.3 Build version 12C33”
It means you have Xcode on your system.
- STEP 3: Open the Xcode and go to “Preferences,” then select “Location”
- STEP 4: Go to the “Command Line Tools” box and choose your XCode version.
- STEP 5: Now, open your terminal and run the command below
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you use a Mac M1, run this command instead:
echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.zshrc
After running it, close your terminal and reopen it again.
You can follow the steps below if you want to enable Brew on your Mac.
The first thing you need to do is to download Xcode because it contains the tools that Homebrew needs to operate correctly.
Follow the steps below to install Xcode:
- STEP 1: Select “Go” from your “Finder.”
- STEP 2: Click on “Utilities.”
- STEP 3: When your Mac displays all the utilities, find the “Terminal” app and launch it.
- STEP 4: Run the command below in your terminal to install Xcode
- STEP 5: Select “install” when you get a prompt asking you to proceed with the installation.
- STEP 6: The script will display the Xcode License Agreement. You will need to indicate that you agree to the terms of installation by clicking on “Agree.”
- STEP 7: Wait for the software to finish installing.
Follow these steps to install Homebrew:
- STEP 1: Download the installation script:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- STEP 2: When the system requests your administrator password, enter it and press “Return” to continue.
- STEP 3: Wait for the download to finish.
It may take a while for Homebrew to finish installing, so you should wait until you see a successful installation message on your screen.
Follow the steps below to add brew to zsh:
- STEP 1: First, open the .zshrc file by using this command: nano ~/.zshrc
- STEP 2: Add the following command to the file: export PATH=”/usr/local/bin:$PATH”
- STEP 3: Save the file.
- STEP 4: Enter the following command to apply the changes: source ~/.zshrc
Here are a few ways to know if you have already installed Homebrew on your Mac.
- Open your terminal and enter the command: brew –version
If you get this type of message: “zsh: command not found: brew,” it means you don’t have Homebrew on your system.
If you have Homebrew on your system, you will get a message indicating your Homebrew version type. You may also get a message that starts with something like this;
brew search [TEXT|/REGEX/]
brew info [FORMULA…]
- You can also use the which keyword. Simply input this command: “which brew“
If you have Homebrew on your system, it will return a message indicating the file path of the Homebrew’s location.
However, if you don’t have Homebrew on your system, it will return an error message like this: “brew not found“
We hope we’ve been able to help you with a working solution to your “brew command not found” error.
If none of the solutions worked for you, you could consider making a complaint on Homebrew’s GitHub repository. Some of their developers may be able to help you.
- Getting the “OS X Could not Be Installed on Your Computer” Feedback? Best Fixes
- What is RivaTuner Statistics Server?
- What Is Waves MaxxAudio Service Application?
- Why Is My Ethernet Slower Than WIFI?
I am Ola, a tech writer with a passion for breaking down complex technical concepts into easy-to-understand language. With over five years of experience in the tech industry, I have a wealth of knowledge on a variety of topics, from software development to cybersecurity. My writing style is clear, concise and engaging, making it easy for readers to grasp even the most complex technical concepts.