In this article, we have provided the working solutions for the brew command error. Have a look at them below.

Why Do I Get ‘brew: command not found?”

As mentioned above, one of the common reasons for getting the ‘command not found brew’ on Mac is due to the executable brew directory not being present in the ‘PATH’ environment.

How to Fix “Something went wrong” Error on YouTube?How to Fix err_empty_response error in Google Chrome?How to Fix Disney Plus Error Code 142?

What is the ‘PATH’ Environment Variable?

These are the system variables that can be accessed by both the processes as well as the users operating the OS. Environment variables store the values system-wide, and ‘PATH’ is one such variable under it. ‘PATH’ has the address of directories that are searched for the executable files of a program.

How to Fix ‘Command Not Found brew Mac’ Error?

Method 1: Reinstall Homebrew

When the Homebrew software does not perform as expected, the best way is to uninstall the software and then reinstall it. If you want to uninstall the ‘Homebrew’ software completely, without leaving any cache, then you need to open the terminal on your Mac and then enter the following command: This is a command given by the official developers of Homebrew on Github.

After you uninstall the Homebrew software completely, restart the system.Now, go to the Homebrew website and then paste the following code for installation:

Since the Homebrew is completely rewritten on the ‘Bash’ platform, instead of ruby, the command line is changed to /bin/bash.

Method 2: Install ARM Version on M1 Device

If you are using a Mac powered by an M1 chip, then your device shows an instruction to add brew to the zsh configuration file with the name .zprofile. Instead of the path /usr/local/homebrew, you need to install Homebrew in /opt/Homebrew. Use the following code on your M1 Device to install the ARM version of Homebrew: You can also add the brew to .zshrc by following the command given below:

Method 3: Install XCode on your Mac

Most Mac users have complained that the Homebrew software was not running if the Xcode was not installed on the system. So, you need to have an Xcode on your system; follow the process for the same below:

Firstly, run the following command to know if the XCode is already installed on your system or not.

In case if the XCode is already installed on your Mac, you will find the exact version like this:

Now, open the Xcode and navigate to Preferences → Location. You can find this option under the ‘Command Line Tools.’

Now, run the following command after opening the terminal:

For Mac M1 users, it is recommended to use the following command:

Conclusion

We hope this article has helped you fix the ‘command not found brew’ error on your Mac. In case none of the above-mentioned methods work, then we recommend you raise a complaint on Github on the Homebrew repository.

How to Fix  Command Not Found brew  Error in Mac  - 60How to Fix  Command Not Found brew  Error in Mac  - 30