. Advertisement .
..3..
. Advertisement .
..4..
Encountering a warning while installing homebrew on macOS Big Sur (M1 chip) is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
What Can You Do When Encountering a warning While installing homebrew on macOS Big Sur (M1 chip)?
You get the problem when wokring on Mac OS Big Sur (with M1 chip). It seems that it is the directory where the homebrew binaries are put. Even it appear issue when installing the plain old /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The following issue has been shown.
homebrew Warning: /opt/homebrew/bin is not in your PATH.
The best solutions for the error
Approach 1:
If the warning is showing that this is the location where binaries or homebrew are stored, thus you must include homebrew PATH into ~/.zshrc OR ~/.bashrc.
To include PATH, follow the steps below:
- Add the following to the end of your /.zshrc or /.bashrc file:
- Put this line at the end of the file: export PATH=/opt/homebrew/bin:$PATH
- That is all there is to it.
More information on the current state of Homebrew on a Mac with an M1 chip may be found here: Support for Apple Silicon in Homebrew
Approach 2:
To fix this, you can:
1. Add the following to the end of your ~/.bashrc file:
export PATH=/opt/homebrew/bin:$PATH
2. To edit:
vi .bashrc
3. If bashrc isn’t found:
touch ~/.bashrc
4. Then, paste:
export PATH=/opt/homebrew/bin:$PATH
5. In your file, save and close the file, then reload bash or
source ~/.bashrc
It’s okay now.
Approach 3:
1. Make sure you’ve already done so. Xcode must be installed.
/usr/bin/xcodebuild -version
2. This will print the sample output shown below. Version 12C33 of Xcode 12.3.
3. Now, launch Xcode. Choose your preferences Choose a location tab. Choose the Xcode version from the dropdown menu in the Command Line Tool.
4. Run the following command in a terminal.
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”
5. Note: If you own an M1 Chip Mac, run the following command, then close and reopen the terminal.
echo “export PATH=/opt/homebrew/bin:$PATH” >> ~/.zshrc
Approach 4: Add the command to .bashrc
(or .zshrc
)
Type these command to the .bashrc
(or .zshrc
):
if [[ "$(uname -m)" == "arm64" ]]; then
export PATH="/opt/homebrew/bin:${PATH}"
fi
It will check the architecture is ARM (like MacOS M1). It will perffect if you are sharing the same .bashrc
(or .zshrc
) configuration across multiple computers with different architectures.
Conclusion
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your issue when encountering a warning while installing homebrew on macOS Big Sur (M1 chip) quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Leave a comment