I installed brew before, but it does not work now.
When I run brew, it gives me the error -bash: brew: command not found
So I tried to reinstall using the code
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
But it gives me another one :
It appears Homebrew is already installed. If your intent is to reinstall you should do the following before running this installer again: rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
If I use the command rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup, it gives back the first error : -bash: brew: command not found
What should I do now?
open -a textedit ~/.zshrcand add the command on it's own line at the top of the file and save the file. if the file doesn't exist, create it by runningtouch ~/.zshrc– Matt S Feb 11 '22 at 02:33fishadding the same snippet to.config/fish/config.fishmakes it work forfishon an M1 Mac. Thanks for the solution – MkMan Jun 20 '22 at 22:54Btw, this fixed my problem too, which was a PATH variable thing.
This is because the
– Ben Page Oct 06 '23 at 22:03brew shellenvcommand outputs commands to set PATH and a few other variables.