zsh: command not found: brew

Hongtao Hao / 2023-10-03


I saw this post on Stackoverflow. This answer is mostly correct but it omits lots of details. For example, I don’t have a .zshrc file in the begining, how do I create it first. After entering export PATH="/opt/homebrew/bin:$PATH", how do I save and exit?

This post is to help solve this problem.

First of all, open your Terminal. If you don’t have a .zshrc file, input

touch .zshrc

Then, input

nano .zshrc

After openning .zshrc, copy and past

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

Then, press control + O, then press Eenter, then press control + X.

Then, in terminal, input

source ~/.zshrc

Then, you can check whether brew in your path variable by

brew version
#Programming

Last modified on 2023-10-03