Getting a warning when installing homebrew on MacOS Big Sur (M1 chip)

InstallationHomebrewWarnings

Installation Problem Overview


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?

Installation Solutions


Solution 1 - Installation

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.

Solution 2 - Installation

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.

Solution 3 - Installation

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.

Solution 4 - Installation

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

Solution 5 - Installation

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.

Solution 6 - Installation

From 2.6.0, they started supporting (kinda) M1. Well, even though they do recommend us 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.

So, it looks like they want you to add the path manually into /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.

Solution 7 - Installation

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

source ~/.zshrc

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJun YinView Question on Stackoverflow
Solution 1 - InstallationXavierBView Answer on Stackoverflow
Solution 2 - InstallationJangoView Answer on Stackoverflow
Solution 3 - Installationlaxman vermaView Answer on Stackoverflow
Solution 4 - InstallationVarma MukeshView Answer on Stackoverflow
Solution 5 - InstallationKurt BourbakiView Answer on Stackoverflow
Solution 6 - InstallationVignesh WarView Answer on Stackoverflow
Solution 7 - InstallationLaxmanView Answer on Stackoverflow