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. What is the ‘PATH’ Environment Variable? These are the system variables that can be accessed by both the processes and the users operating the OS. Environment variables store the values system-wide, and ‘PATH’ is one such variable. ‘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 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, copy and then paste the following code into the macOS terminal for installation (go to the Homebrew website to cross-check the installation command):
Since the Homebrew is completely rewritten on the ‘Bash’ platform, the command line is changed to /bin/bash instead of ruby. Now, run the following command to set the PATH: Install ARM Version on M1 Device If you are using a Mac powered by an M1 chip, 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: Now, run these two commands in your terminal to add Homebrew to your PATH: You can also add the brew to .zshrc by following the command given below:
Method 2: 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:
First, run the following command to know whether or not the XCode is already installed on your system.
In case if the XCode is already installed on your Mac, you will find the exact version like this:
In case, you don’t have Xcode already installed, use the following command to do so:
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. If none of the above mentioned methods work, then we recommend you raise a complaint on Github on the Homebrew repository. Further Reading:
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?
title: “How To Fix Command Not Found Brew Error In Mac " ShowToc: true date: “2023-04-05” author: “Sarah Pitts”
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. What is the ‘PATH’ Environment Variable? These are the system variables that can be accessed by both the processes and the users operating the OS. Environment variables store the values system-wide, and ‘PATH’ is one such variable. ‘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 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, copy and then paste the following code into the macOS terminal for installation (go to the Homebrew website to cross-check the installation command):
Since the Homebrew is completely rewritten on the ‘Bash’ platform, the command line is changed to /bin/bash instead of ruby. Now, run the following command to set the PATH: Install ARM Version on M1 Device If you are using a Mac powered by an M1 chip, 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: Now, run these two commands in your terminal to add Homebrew to your PATH: You can also add the brew to .zshrc by following the command given below:
Method 2: 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:
First, run the following command to know whether or not the XCode is already installed on your system.
In case if the XCode is already installed on your Mac, you will find the exact version like this:
In case, you don’t have Xcode already installed, use the following command to do so:
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. If none of the above mentioned methods work, then we recommend you raise a complaint on Github on the Homebrew repository. Further Reading:
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?