
views
What does “zsh: Command Not Found: Brew” mean?
This error means that Homebrew is not installed correctly. If Terminal is unable to recognize brew commands, it most likely means that you haven’t completed the Homebrew installation. Either Homebrew is not installed at all, or the shell config file hasn’t been updated with the correct Homebrew path. You might also simply need to refresh your shell session if you just installed Homebrew.
Restarting Terminal
Quit Terminal and restart it. In some cases, fixing this error is as simple as starting a new shell session. Typically, you need to restart the Terminal right after installing Homebrew in order for it to work correctly.
Run the brew doctor command. Once Terminal restarts, run this command to check if Homebrew is working. If it is, you should see a message saying Your system is ready to brew. If your version of Homebrew is outdated, this command might trigger an update. If so, it may take a few minutes for the process to complete. If you see the zsh: command not found error after running brew doctor, that means Homebrew isn’t installed correctly or the $PATH hasn’t been set in the shell config file.
Checking Your Homebrew Installation
Enter the brew --version command. If Homebrew is installed, this should trigger Terminal to display the current version (e.g., Homebrew 4.4.21. You can also use the brew doctor command to check. This time, include the full path: If you have an Apple Silicon chip (M1, M2, M3, or M4), use this command: /opt/homebrew/bin/brew doctor For older Macs with Intel processors, use the command /usr/local/bin/brew doctor In Linux, try /home/linuxbrew/.linuxbrew/bin/brew doctor. If this command returns the message Your system is ready to brew, that means that Homebrew is installed, but the $PATH hasn’t been set correctly in the shell config file. If Homebrew isn’t installed, you’ll need to install it before you can continue. Check out this article from the official Homebrew website for detailed installation instructions.
Setting the PATH
Determine Homebrew’s install location. After you install Homebrew, you’ll need to update your shell’s config file before you can run any brew commands. To run this command correctly, you’ll need to figure out the default path to Homebrew on your system. If you have a Mac with an Apple Silicon chip (M1, M2, M3, or M4), the default install location is /opt/homebrew. For Intel Macs, the default path is /usr/local. On Linux, it’s /home/linuxbrew/.linuxbrew.
Update your shell’s config file with the correct Homebrew path. Typically, you can do this from within Terminal when you first install Homebrew. Right after installation, you’ll see a line in the Terminal window that says something like this: Next steps: - Add Homebrew to your PATH in /Users/$USER/.zprofile: echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofileeval $(/opt/homebrew/bin/brew shellenv) Copy and paste the line echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile into the Terminal window and press Return. The exact format of the line will depend on your system and Homebrew’s install location. Then, copy and paste eval $(/opt/homebrew/bin/brew shellenv) into Terminal and press Return again. Quit Terminal and reopen it. You should now be able to use Homebrew.
Update the configuration file manually if needed. If you didn’t follow these steps when you initially installed Homebrew, you can still update the config file manually. Here’s how:
First, you may need to create the correct config file by entering the command touch ~/.zprofile in Terminal.
Enter the command open -e ~/.zprofile to open the file in TextEdit.
Add the following line to the file: eval "$(
Quit and restart Terminal. Once you’ve updated the shell config file, you’ll need to restart your shell session. Either quit Terminal and restart, or use the command source ~/.zprofile to reset the shell environment. Once Terminal restarts, you should be able to run brew commands!
Comments
0 comment