. Advertisement .
..3..
. Advertisement .
..4..
While running homebrew on macOS Big Sur, the following problem Warning: /opt/homebrew/bin is not in your PATH in macOS Big Sur appears. If you encounter the same issue, the below article will fill you with all possible solutions to this problem. So, let’s get started!
What Is The Warning: /opt/homebrew/bin is not in your PATH in macOS Big Sur Error?
When you looking for some blogs about M1 chip and thought you would need to install Rosetta 2 on the mac to install homebrew.
But, before you Rosetta 2, you tried installing the plain old /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
. The went through, and you saw “Installation successful!”. However, the only problem is that you saw the following warning.
Here is what the error looks like.
Cloning into ‘/opt/homebrew/Library/Taps/homebrew/homebrew-core’...
remote: Enumerating objects: 67, done.
remote: Counting objects: 100% (67/67), done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 877969 (delta 32), reused 39 (delta 20), pack-reused 877902
Receiving objects: 100% (877969/877969), 348.33 MiB, 11.95 MiB/s, done.
Resolving deltas: 100% (594177/594177), done.
Tapped 2 commands and 5416 formulae (5,724 files, 382.4MB).
Already up-to-date.
Warning: /opt/homebrew/bin is not in your PATH.
The simple solutions for the error
It is the location where the packages or homebrew are stored. Thus you must add the homebrew path to /.zshrc OR /.bashrc.
Solution 1
For the above reason, follow these steps to add PATH.
- Add the following to the end of your /.zshrc or /.bashrc file:
- Insert the following line at the end of the file:
export PATH=/opt/homebrew/bin:$PATH
Solution 2
With the second solution,
- Fix your ~/.bashrc.
export PATH=/opt/homebrew/bin:$PATH
- Then, if you wish to edit it, apply the following example.
vi .bashrc
- If you cannot find bashrc, use this command.
touch ~/.bashrc
- Then paste as normal.
export PATH=/opt/homebrew/bin:$PATH
- Open the file, save and exit, and then restart bash.
source ~/.bashrc
Then you’re all set.
Solution 3
- Check to see if you’ve already installed the Xcode. In your application, type the following command: /usr/bin/xcodebuild -version
- It will display the example output shown below. Version 12C33 of Xcode 12.3
- Now launch Xcode. Choose your preferences. Choose the location tab. Pick your Xcode edition from the dropdown menu.
- Run the following command: /bin/bash -c $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)
- If you have an M1 Chip Mac, perform the following command, close and reopen the terminal.
>> echo “export PATH=/opt/homebrew/bin:$PATH ~/.zshrc
Solution 4
Add these lines to the .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.
Conclusion
Take your time and visit our blog post if you cannot solve the Warning: /opt/homebrew/bin is not in your PATH in macOS Big Sur error. We believe you will resolve the problem after you finish reading our solutions.
Please let us know by posting your solution below if it is not. Thank you, and we hope you found our post helpful!
Leave a comment