How to fix command not found brew (bash, zsh) on macOS Terminal

code2care@mac bin % brew
zsh: command not found: brew
code2care@mac bin % 

If you get brew command not found error when you run a brew command on zsh (or any other shell like bash) on macOS Terminal, there could be few reasons, 1) you many have not installed brew - if so please follow this article - Installing Brew, 2) you many not have set the PATH for brew,

Brew command not found fix
Brew command not found fix

Adding brew to PATH variable:

  1. Open Terminal,
  2. Go to /opt/homebrew/bin/ (if you do not find this path - brew is not installed - Article - Installing Brew),
  3. Run: export PATH=$PATH:/opt/homebrew/bin,
  4. Try running the brew version command to validate,
code2care@mac % brew --version
Homebrew 3.0.0
Homebrew/homebrew-core (git revision f1b2a2; last commit 2021-02-10)
code2care@mac / % brew help
Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

  brew config
  brew doctor
  brew install --verbose --debug FORMULA

  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]

Further help:
  brew commands
  brew help [COMMAND]
  man brew


  • I was trying to install brew on my new Macbook and got stuck on this, thanks!!! worked like a charm!
    Mike J: 02 Jan 2222 14:01:28 GMT
  • Further comments disabled!
Try Out Code2care Dev Tools:


Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR -