How to fix Mac Homebrew error 'zsh: command not found: brew'
Don't worry, though, as we'll explore some potential solutions to fix this problem below.
1. Try reinstalling Homebrew
Reinstalling Homebrew can delete any corrupt or outdated files and install a new copy of Homebrew. To remove Homebrew, you can follow these steps:
a. Open Terminal on your Mac and uninstall Homebrew by typing the following and pressing the Return key :
brew uninstall --force homebrew
b. Enter the following command and press Return to reinstall Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This command will download and install the latest version of Homebrew. After restarting the Terminal application, you should be able to use the brew command without any problems.
2. Add Brew to the PATH environment variable
Most likely Homebrew could not be added to the PATH variable during the installation process, meaning your shell cannot locate the Homebrew executable.
You can fix this problem by manually adding Homebrew to your PATH through Terminal. The command varies slightly depending on whether the Mac has an Intel processor or an Apple silicon chip. Just copy and paste the appropriate command for your Mac into the Terminal app.
If you have a Mac with an Apple silicon chip, enter this command:
export PATH="/opt/homebrew/bin:$PATH"
If your Mac has an Intel processor, enter this command instead:
export PATH="/usr/local/bin:$PATH"
You can check if Homebrew has been successfully added to the PATH variable with the following command:
echo $PATH
This will display all executable binaries that Terminal can find. If Homebrew is in the list, it means Terminal was able to successfully locate the Homebrew executable.
3. Install Xcode Command Line Tools
Xcode Command Line Tools is a package developed and maintained by Apple that contains all the debuggers, compilers, and tools included with the entire Xcode IDE. Some users have reported that Homebrew cannot function without Xcode Command Line Tools installed. You can install by entering the following command into Terminal and pressing Return :
xcode-select --install
You can then verify the installation with the following command:
xcode-select -p
If the installation is successful, you will get the following output after entering the command:
/Library/Developer/CommandLineTools
Homebrew offers a number of useful applications and is an indispensable utility for every power Mac user. If you get the "zsh: command not found: brew" error, one of the troubleshooting steps the article discussed above will resolve the problem and let you enjoy the best package manager available. for macOS.
You should read it
- How to make Wii U useful with Homebrew
- How to Install and Use Homebrew on Linux
- Instructions for installing software with Homebrew on macOS X
- How to use Homebrew to install software on Linux and Windows
- How to Hack Your Wii Games for Free
- Switching from Mac to Linux is easier with the following 5 tips
- How to Play Wii Games from an External Hard Drive or USB
- Chocolatey or Windows Package Manager is the better tool to download Windows software?
- The new system uses Twitter, AI to forecast floods
- Microsoft will release Office 2019 next year
- People succeed, what do they do on Sunday night?
- Trick to convert docx tail to quick doc