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!
Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.