After installing the homebrew on my macOS, when I ran the brew command on the Terminal app I received the error zsh: command not found: brew
Solution to brew not found error!
When you install brew in macOS it gets installed at the location - /opt/homebrew, in order to run the brew command you need to cd this location and get into the bin directory and run the brew commands.
The above solution will work but is not an ideal way of running the brew command, it's better to add the path of brew installation in the .zshrc file
- Open the .zshrc file using command: nano ~/.zshrc,
- Now add the following to the file: export PATH="$PATH:/opt/homebrew/bin/"
- Save the file by pression Control + X followed by Enter.
- Apply the changes by command: source ~/.zshrc
Now you can run the brew command from anywhere!
Have Questions? Post them here!
More Posts related to zsh,
- Ubuntu zsh: command not found: nano
- Setting up Zsh Syntax Highlighting
- Fix for zsh: command not found: brew
- Fix - zsh: command not found: conda [macOS]
- Resolve - zsh: command not found: code
- How to make zsh as the default shell on Ubuntu
- zsh: exec format error eclipse M1 Mac
- [fix] zsh: illegal hardware instruction python TensorFlow M1/M2 Mac
- Fix zsh: permission denied: script.sh
- zsh: command not found [fix] macOS
- Turn on off volume change button sounds Mac OS X - Mac-OS-X
- Word-wrap Eclipse Console logs - Eclipse
- Delete Android Studio Projects - Android-Studio
- Eclipse Error : The Eclipse executable launcher was unable to locate its companion shared library. - Eclipse
- How to clear ZSH history of commands executed on Mac Terminal - zsh
- Install Native Java JDK JRE on Apple Silicon M1 Mac - MacOS
- [fix] Cannot connect to the Docker daemon at unix:var/run/docker.sock. Is the docker daemon running? - Docker
- Multiple ways to Convert tabs with spaces in Notepad++ - NotepadPlusPlus