I am attempting to install Homebrew on MacOS but keep getting the error Warning: /opt/homebrew/bin is not in your PATH. I have updated my .zshrc to include export PATH=/usr/local/bin:$PATH but have had no such and continue to not be able to access brew commands. I am running MacOS BigSur and am attempting to set up a ruby coding environment.
By running /opt/homebrew/bin/brew doctor as noted in the warning as opposed to brew doctor I was given the correct notation for updating my .zshrc file export PATH="/opt/homebrew/bin:$PATH as opposed to export PATH=/usr/local/bin:$PATH as indicated in several answers to similar questions. After running source ~/.zshrc and brew doctor the system confirmed the path had been updated properly.
Related
I have an M1 Mac Mini. Every time I want to use brew in a new terminal, it tells me :
zsh: command not found: brew
So I always do this to solve it :
export PATH=$PATH:/opt/homebrew/bin
But then the next time I open a terminal, this has been forgotten. Is there a way to make it stick? I wonder why the homebrew installation doesn't do this by default? (It does warn me that it's not added to the path during installation).
Thanks!
Create/open the ~/.zshrc file and add this line to it: export PATH=$PATH:/opt/homebrew/bin
I have googled around the error I was experiencing but from what I could tell this issue is likely related to how the path in which Homebrew is saved for Big Sur/Apple Silicon is different than other Macbook approaches.
Following the instructions on the Homebrew page, I ran the cURL command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
However, after the operation successfully completed, there was a warning in terminal:
warning: bin/opt/ path does not exist
And when I attempted to run a brew doctor the command was not found.
It's clear there is a pathing issue, but how do I solve it
In this case, I discovered it was a combination of a PATH issue as well as the .zshrc file was missing from the ~/ directory
I was able to resolve the issue with these steps.
Navigate to cd /opt/homebrew/bin/
Run export PATH=$PATH:/opt/homebrew/bin
Navigate back to "home" with cd ~/
in this directory I found that there was no .zshrc file (:scream:)
So I created a file with touch .zshrc and then
ran this command: echo export PATH=$PATH:/opt/homebrew/bin >> .zshrc
And after running that command, I was able to successfully use the brew doctor and other related commands!
I just installed ssldump on a mac computeg using brew. The installation process ran without reporting any issues (ssldump-0.9b3 already installed). However, when I try running ssldump from the same prompt or a new terminal window, the error message I get is:
-bash: ssldump: command not found
Is there anything else that i need to do to make this work on a Mac El capitan (v10.11.6)?
Simply using brew install ssldump did not work for me as ssldump was added in /usr/local/sbin (which was neither mentioned on /etc/paths nor in .bash_profile). I ended up adding /usr/local/sbin to the .bash_profile and used sourced the file to enable the change.
cd ~
sudo vi .bash_profile
add to the file:
export PATH=/usr/local/sbin:$PATH
&
source .bash_profile
I am on Mac OSX 10.11 after running
brew doctor
And there is a warning in my terminal.
Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc
After I fixed this PATH in my .zshrc file, I run brew doctor again,
this error is still remain.
Any suggestions?
What my .zshrc file now looks like:
export PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
I finally solved this problem by restarting my terminal and run brew doctor again.
Warnings disappear!
you can resolve this problem : delete all "unbound" * in /usr/local/sbin;
Then cakebrew and homebrew doctors are OK
Have a nice day
I installed MongoDB via Homebrew (following http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/) but it's not working.
Typing mongod at shell prompt gives me:
-bash: mongod: command not found
Not sure if I need to add something for Homebrew to my PATH env var?
I can see Mongo is installed under /usr/local/Cellar/mongodb – but am assuming I don't need to add everything I install via homebrew to the path? Also, assuming I can run mongod from any directory or am I actually meant to be in install directory?
When I run brew doctor I get:
Warning: You have unlinked kegs in your Cellar
Followed by a list of 3 items which includes MongoDB – but I'm not sure how I'm meant to link them?
Works perfectly
brew update
brew tap mongodb/brew
brew install mongodb-community#4.2
For latest version, check https://docs.mongodb.com/manual/release-notes/
You're getting this error because your 'brew' install failed to create the correct symlinks in /usr/local/bin. As a result, the shell can't find the mongo executables in your $PATH. You can fix this using the following steps:
Check the permissions on /usr/local/bin and make sure that you own that directory and have write permissions on it
$ ls -ld /usr/local/bin
Once you've fixed that, run 'brew link' to fix the symlinks
$ brew link mongodb
If you are on mongodb-community#4.0. You can try to reinstall with brew reinstall mongodb-community#4.0.
Then I get the following hint:
==> Caveats
mongodb-community#4.0 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have mongodb-community#4.0 first in your PATH run:
echo 'export PATH="/usr/local/opt/mongodb-community#4.0/bin:$PATH"' >> ~/.bash_profile
So you can just copy the echo command and restart your shell!
Copied from a different channel running these commands in the terminal updated the installation/configuration issues as described in OP
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
I faced the same problem and this solution seemed to work for me. I had previously uninstalled mongodb and reinstalled it through homebrew which gave me a bunch of problems. This solution seemed to work just fine.
brew uninstall --force mongodb
brew cleanup -s mongodb
brew cleanup --prune-prefix
brew install mongodb
It works from the directory since the sh searches the ENV path and then the cwd for a program named mongod. I have been looking around a little and it seems that the default install of MongoDB (I am not a Mac user) does not install a rc or init script for which sh to understand it's running behaviour as stated here:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/#using-mongodb-from-homebrew-and-macports
The packages installed with Homebrew and MacPorts contain no control
scripts or interaction with the system’s process manager.
If you have configured Homebrew and MacPorts correctly, including
setting your PATH, the MongoDB applications and utilities will be
accessible from the system shell. Start the mongod process in a
terminal (for testing or development) or using a process management
tool.
So you must actually define (as you said) MongoDBs path, here is an example: https://snipt.net/sido/installing-mongodb-on-os-x/
Edit: the example is not mine. I just stole it from it's user: https://snipt.net/sido/