3

I had homebrew installed on my mac. Today after sometime, I tried to download psql through brew on my mac on terminal but I keeping getting:

zsh: command not found: brew

I have it installed so I do not know why zsh is not picking brew?

James Z
  • 12,209
  • 10
  • 24
  • 44
devgirl
  • 671
  • 3
  • 16
  • 39
  • 2
    You probably need to add the directory where `brew` is located to your path. Try adding `path+=(/usr/local/bin)` to the `.zshrc` file in your home directory and restarting the terminal session. More about paths here: https://stackoverflow.com/questions/11530090/adding-a-new-entry-to-the-path-variable-in-zsh and here: https://andysbrainbook.readthedocs.io/en/latest/unix/Unix_04_ShellsVariables.html – Gairfowl Jan 26 '21 at 22:49

1 Answers1

2

First you have run the below command for install homebrew on particular path

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

And then set the path using below command

echo export PATH="/opt/homebrew/bin:$PATH" >> ~/.zshrc

Its working fine for MacOS

Srinivasan_iOS
  • 972
  • 10
  • 12
  • `export PATH="/opt/homebrew/bin:$PATH" >> ~/.zshrc` does not add the line starting with `export PATH` to `~/.zshrc`. It only adds the _stdout_ from running that command to `~/.zshrc`, and the command has no stdout at all. – Charles Duffy Feb 21 '22 at 00:04
  • Maybe you want to suggest `echo 'export PATH="/opt/homebrew/bin:$PATH"' >>~/.zshrc` instead? – Charles Duffy Feb 21 '22 at 00:05