How to Add Brew to PATH M1/M2 Mac

Set brew to PATH M1 or M2 Mac

If you have brew installed on your device and yet you get an error saying command not found brew, then probably you have not set the brew to the PATH variable.

How to add brew to PATH on M1/M2 Mac

  1. Open Terminal App,
  2. Open .zshrc file located under your user root directory,
    % nano ~/.zshrc
  3. Add the below line PATH=$PATH:/opt/homebrew/bin
  4. Save the file: Contol + X followed by Y to save
  5. Now run source ~/.zshrc
  6. You have permanently set brew to PATH environment variable.

Have Questions? Post them here!

Top Hashtags: