100

Has anyone seen this warning while installing homebrew? What does it mean? Should I be worried?

Warning: /opt/homebrew/bin is not in your PATH. enter image description here

Some background info:

I read some blogs about M1 chip and thought I would need to install Rosetta 2 on my mac in order to install homebrew.

However, before I Rosetta 2, I tried installing the plain old /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". The went through, and I saw "Installation successful!"

The only issue is that I saw the following warning.

homebrew Warning: /opt/homebrew/bin is not in your PATH.

Should I be worried? What does it mean?

Sanket Shah
  • 2,888
  • 1
  • 11
  • 22
Jun Yin
  • 2,019
  • 3
  • 16
  • 18
  • 11
    **DO NOT post images of code, data, error messages, etc.** - copy or type the text into the question. [ask] – Rob Jan 13 '21 at 01:54
  • 1
    Please note that a review audit of this post is being discussed in [Review audit of a question with a downvote and a close vote](https://meta.stackoverflow.com/q/404417/12695027) – Scratte Jan 13 '21 at 04:11

7 Answers7

199

I had the same issue today, on Mac OS Big Sur (with M1 chip). The problem is indicated in the warning : Warning: /opt/homebrew/bin is not in your PATH. It seems that it is the directory where the binaries of hombrew are put. To resolve, you can do :

  1. Edit your ~/.zshrc or ~/.bashrc with at the end of file:
export PATH=/opt/homebrew/bin:$PATH

After this, tap source ~/.zshrc in your terminal or restart it.

For more infos about the current status of Homebrew on Mac with a M1 chip : Apple Silicon support in Homebrew

Edit : As mentioned by @kangkyu in this comment, Homebrew is changing to version 3.0.0 which supports officially Apple Silicon. If you have a prior version just brew update.

Eduardo Cuomo
  • 17,828
  • 6
  • 117
  • 94
XavierB
  • 2,198
  • 1
  • 9
  • 12
  • 1
    Thank you so much! I am aware that Mac OS Big Sur uses zsh instead of bash now. However, I cannot find my ~/.zshrc file. Is that the same with you? – Jun Yin Dec 30 '20 at 01:52
  • 2
    I have configured my zsh with oh-my-zsh, so I think he created the ~/.zshrc file for me. Maybe you can create it manually (if you don't want oh-my-zsh), and add the line in my answer, and after relaunch your terminal (or tap : source ~/.zshrc to take effect). – XavierB Dec 30 '20 at 10:14
  • 1
    I am still getting this warning "Warning: /opt/homebrew/bin is not in your PATH", after adding "export PATH=/opt/homebrew/bin:$PATH" at end of " ~/.zshrc". Please help – Shivani Bajaj Dec 31 '20 at 11:31
  • Hi @ShivaniBajaj, when you type "echo $PATH" in your terminal, what do you see? – Jun Yin Dec 31 '20 at 16:33
  • Hey @JunYin, I see this path "/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/shivanibajaj/.rvm/bin" – Shivani Bajaj Dec 31 '20 at 19:09
  • 2
    Hi @ShivaniBajaj, we don't need to reinstall homebrew. It has already been installed. If you do "cd /opt" and "ls", you shall see "homebrew" there. The warning is saying that we have to type the full path to execute brew. Even without adding "export PATH=/opt/homebrew/bin:$PATH", brew is usable, but every time instead of "brew" you need to type "/opt/homebrew/bin/brew". If typing "brew" brings up the brew prompt, then you are all-set. If not, have you tried to run "source .zshrc" in your terminal after adding "PATH=/opt/homebrew/bin:$PATH" into your ~/.zshrc file? Or restart the terminal? – Jun Yin Dec 31 '20 at 23:04
  • PATH should be with or without quote? export PATH="/opt/homebrew/bin:$PATH" or export PATH=/opt/homebrew/bin:$PATH ? – Greg Jan 13 '21 at 18:26
  • For other user if the .zshrc file doesn't exist just creat it – Bilal Jan 29 '21 at 22:09
  • Homebrew 3.0.0 works with M1 chip (since yesterday) https://brew.sh/2021/02/05/homebrew-3.0.0/ – kangkyu Feb 07 '21 at 09:59
  • Hi @Greg, to answer your question, follow this link : https://stackoverflow.com/a/33318886/8765917 – XavierB Feb 09 '21 at 07:00
  • I've had the same issue with Big Sur with M1 Chip and had the same assumption that there is a correlation. Thanks for this answer, it's always a joy that first the first google is a hit – OfirYaron Mar 15 '21 at 19:32
  • Works like a charm! Thanks – Berkay Kirmizioglu Feb 07 '22 at 23:28
  • In my case, I just needed to run next steps commands. See answer below from Jango – Mateus Nascimento Jun 27 '22 at 18:04
  • The above stated solution doesn't work for me on M1 chipset, I tried these commands and it's working fine. sharing the commands :1 command `echo '# Set PATH, MANPATH, etc., for Homebrew.'` 2nd command `echo 'eval "$(/opt/homebrew/bin/brew shellenv)"'` and last command `eval "$(/opt/homebrew/bin/brew shellenv)"` – surender pal Oct 10 '22 at 06:02
70

Massage After homebrew installation

I have this warning too, but if you look at the "Next steps" and run those two lines, then you would be fine.

Jango
  • 852
  • 5
  • 8
25

I also have the same issue today, on Mac OS Big Sur (with M1 chip). After installing from Homebrew homepage.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

To resolve, you can do :

Edit your ~/.bashrc with at the end of file :

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

To edit

vi .bashrc

if bashrc not found

touch ~/.bashrc

and paste

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

in the file then save and quit the file and then reload bash or

source ~/.bashrc

and you're good to go.

laxman verma
  • 351
  • 2
  • 3
13

How To Set Up Your Mac for Homebrew

Step 1

Check you have already Install the Xcode. Run the below command in your terminal

/usr/bin/xcodebuild -version

It will print the below sample output Xcode 12.3 Build version 12C33

Step 2

Now Open Xcode Select preferences Select location tab Now in command Line Tool select your Xcode version from dropdown menu

Step 3

In terminal run below command

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Note : if you have M1 Chip Mac run the below command, close terminal and open the terminal again

echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.zshrc

Varma Mukesh
  • 883
  • 6
  • 12
10

This is an issue you experience when installing homebrew on an ARM architecture (like the MacOS with M1 chip).

You can add these lines to your .bashrc (or .zshrc):

if [[ "$(uname -m)" == "arm64" ]]; then
  export PATH="/opt/homebrew/bin:${PATH}"
fi

This will check whether your architecture is ARM (like MacOS M1) and add the path only if that's the case. It is especially useful if you are sharing the same .bashrc (or .zshrc) configuration across multiple computers with different architectures.

I suppose that Homebrew will implement this automatically soon enough: they're doing a lot of good work on fixing issues with ARM architecture right now.

Kurt Bourbaki
  • 11,984
  • 6
  • 35
  • 53
6

From 2.6.0, brew partially supports M1. Well, even though they do recommend to run brew via rosetta 2, if it's working for you, then you don't need to worry.

You can read the full changes here: https://brew.sh/2020/12/01/homebrew-2.6.0/

macOS Homebrew running natively on M1/Apple Silicon/ARM has partial functionality. We recommend installing into /opt/homebrew and forbid installing into /usr/local (to avoid clashing with the macOS Intel install and allow their usage side-by-side). We currently recommend running Homebrew using Intel emulation with Rosetta 2.

It's mentioned that they want you to add the path manually for /opt/homebrew and that's probably the reason why you got the warning.

To fix this:

  • edit your .zshrc (if it does not exist, create one)
  • add export PATH=/opt/homebrew/bin:$PATH and save the file.
  • relaunch the terminal or source ~/.zshrc

This should fix the warning and try running brew help or brew -v to check whether the path is added as intended.

Vigneshwar M
  • 83
  • 1
  • 10
3

For macOS Big Sur version 11.0.1 copy the contents of your ~/.bashrc to ~/.zshrc then reload

source ~/.zshrc
Laxman
  • 209
  • 2
  • 5
  • Copying "export PATH=/opt/homebrew/bin:$PATH" to either ~/.bashrc or ~/.zshrc should work. I tested it yesterday. It seems that although macOS Big Sur is using zsh now, adding sys links to ~/.bashrc file also works. I am not exactly sure why that's the case. – Jun Yin Jan 01 '21 at 17:38