Pages

Thursday, January 19, 2023

command not found: brew macos (Mac is M1-based)

If your shell is zsh and your Mac is M1-based, enter these two commands after installing brew:

  • echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
  • eval "$(/opt/homebrew/bin/brew shellenv)"

The first command adds:

  • an expanded PATH variable that includes the directories where brew and commands installed with brew are located
  • several shell variables used by brew

to the .zprofile initialization file.

The second command adds those same variables to the current shell, so that you can start using brew without re-reading .zprofile.

  • PS: For Intel Macs, use /usr/local instead of /opt/homebrew.
  • PPS: If you are running bash, use .bashrc instead of .zprofile.

No comments:

Post a Comment