How can I permanently add Homebrew to my PATH?

Viewed 3145

I have an M1 Mac Mini. Every time I want to use brew in a new terminal, it tells me :

zsh: command not found: brew

So I always do this to solve it :

export PATH=$PATH:/opt/homebrew/bin

But then the next time I open a terminal, this has been forgotten. Is there a way to make it stick? I wonder why the homebrew installation doesn't do this by default? (It does warn me that it's not added to the path during installation).

Thanks!

1 Answers

Create/open the ~/.zshrc file and add this line to it: export PATH=$PATH:/opt/homebrew/bin

Related