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.

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org



















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap