Homebrew - brew command not found
If you are seeing the error “brew command not found” it probably means that you recently installed Homebrew but something went wrong.
It is with noting that you may or may not need XCode to be installed for Homebrew to work. You probably want to have that installed anyway so go right ahead and install it.
Fix the path?
The first thing you might try is running one of these two commands to set up your path, depending on where brew has been installed.
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile echo 'export PATH="$PATH:/opt/homebrew/bin"' >> ~/.bash_profile
If you are running an M1 Mac or a Mac with Apple silicon, you might need to set your environment up like this after installation:
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> ~/.zprofile eval $(/opt/homebrew/bin/brew shellenv) echo 'export PATH="/opt/homebrew/bin:$PATH"' >> $HOME/.zshrc
If none of this works you might want to try reinstalling homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"