zsh: command not found: brew in mac
Asked Answered
L

2

5

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?

Lyrate answered 26/1, 2021 at 22:29 Comment(1)
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: #11530590 and here: andysbrainbook.readthedocs.io/en/latest/unix/…Herring
M
3

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

Montanez answered 21/1, 2022 at 7:15 Comment(2)
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.Iridescent
Maybe you want to suggest echo 'export PATH="/opt/homebrew/bin:$PATH"' >>~/.zshrc instead?Iridescent
A
3

(it could be similar for windows users as well, but need to check or refer this: https://brew.sh/)

This solution is for Mac Users:

Install using this command in your terminal.

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

Once, it says, Installation is successful, run these commands: (note: replace adminmacks in below queries with your username of mac.)

==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:

    (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/adminmacks/.zprofile

    eval "$(/opt/homebrew/bin/brew shellenv)"

- Run brew help to get started
Auxochrome answered 15/4 at 13:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.