How to fix “Command Not Found brew” error on Mac
“Command Not Found Brew”usually comes from Homebrew on Mac. Homebrew is a package manager for MacOS. This error occurs when Homebrew is not installed, the installation folder is corrupt, or you didn’t provide a path.
This is a common error faced by many Mac users. If you click on this article in the search results hoping to find a fix for this error, you won’t be disappointed.
Fix “Command Not Found brew”error on Mac
This article will list all possible ways to fix zsh: command not found: brew error on Mac.
Reinstall Homebrew
This problem usually occurs if the Home Brew program is not installed correctly. You can reinstall Homebrew, which will fix the problem. Following are the steps for this:
- First, open Terminal on your Mac.
- Now type and run the following command to uninstall Homebrew on your system:
- /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)”After the process is complete, restart your computer.
- Now open the terminal again and run the following command to reinstall Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Change path homebrew
You may encounter the zsh: command not found: brew error on a Mac when the Homebrew path is set incorrectly. You can set the correct Homebrew path to fix this issue. To do this, follow the steps given below:
- Launch Terminal on your Mac.
- For bash you can run the below command to set the path:
$ echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
- In the case of Zsh, you can run the command below to set the path:
echo 'export PATH="/usr/local/bin:$PATH"' >> $HOME/.zshrc
Proper installation of Homebrew
Another thing you can do is fix your Homebrew installation. This can be done by running the following commands in the Terminal one after the other:
export PATH="/opt/homebrew/bin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"' >> $HOME/.zshrc
Install Arm version of Homebrew (only on Mac with M1 chip)
Macs used to come with an Intel processor, but now Apple Macs come with Apple Silicon. If you have a Mac with an M1 processor, you will need to install the Arm version of Homebrew. To do this, open the Terminal and run the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$yourdevicename/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)
Install Xcode
To run Homebrew on your Mac, you must install Xcode. If it is not installed, you may encounter the zsh: command not found: brew error on your Mac. To install Xcode, follow these steps:
- First, launch a Mac Terminal .
- Run the below command to check if Xcode is installed on your system or not.
/usr/bin/xcodebuild — версия
- This will return the version of Xcode to your computer. If it shows the version, it means that Xcode is installed; otherwise no.
- If Xcode is installed, skip this step and go to the next one. If Xcode is not installed, run the command below to install it:
xcode-select --install
- Now run the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you are using M1 Mac, run the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Conclusion
We hope you find a fix for the zsh: command not found: brew error on Mac. If you are facing this error on your Mac, the steps above should help you resolve the issue. However, if you’re still facing this issue, go to the Homebrew GitHub repository and raise your request. You can raise the issue with the respective screenshots of the error and all methods tried and they will show you possible ways to solve the problem.
Leave a Reply