However, while using the brew command, the user may encounter the error zsh: command not found: brew. The occurrence of this error will prevent users to execute brew-related commands.
Read this guide for a quick solution to fix the zsh: command not found: brew error on Mac.
How to Fix zsh: command not found: brew on Mac
When you try to brew-related command on your Zsh terminal, you will encounter the following error:
The main cause of this error to occur in Zsh is because of missing Homebrew installation on your Mac system. By default, Homebrew is not preinstalled on your Mac system and you have to manually install it to use it for installing applications on your system.
Install Homebrew on Mac
The most straightforward way to install Homebrew on Mac is to use the following installation script created by the Homebrew developer.
The above script needs to be run on the terminal to initiate the Homebrew installation on Mac. You may need to enter the user’s password for sudo access.
Then press Enter when asked to begin the Homebrew installation on Mac.
Once the Homebrew installation is completed, ensure the successful installation by running the following command:
This ensures that you have successfully installed Homebrew on Mac and you are good to execute brew-related commands without getting any errors.
Conclusion
Getting the zsh: command not found: brew error on Mac is frustrating because it hinders you from using brew-related commands. You can fix this issue by installing Homebrew on your Mac terminal by executing the official installation script of Homebrew. After the installation, you can test the brew commands to ensure it is working on your system.