Reputation: 453
When I try to run mongod from the terminal, I get the following error:
2014-07-02T23:56:24.797-0700 [initandlisten] ERROR: listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017 2014-07-02T23:56:24.797-0700 [initandlisten] ERROR: addr already in use
I recently realize that I have two versions of MongoDB on my Mac, and think this may be the source for the above error. (Plus, I do not need two version.) I tried Googling, but was not able to find clear directions on how I can uninstall. I have development version 2.7.0 AND 2.6.3.
Thanks so much in advance for the help!
Upvotes: 41
Views: 89256
Reputation: 3575
For those having this error in osx:
brew uninstall mongodb Error: No such keg: /usr/local/Cellar/mongodb
execute brew list | grep mongo
for example, it could show something like:
[email protected]
mongodb-database-tools
mongosh
remove them with brew uninstall [email protected] mongodb-database-tools mongosh
Also execute launchctl remove homebrew.mxcl.mongodb
as @anuvrat-tiku says in his answer.
Upvotes: 2
Reputation: 281
For uninstalling the community version, i found that the command brew uninstall mongodb-community
worked for me
Upvotes: 24
Reputation: 131
Nitin Jadhav version worked for me, brew uninstall mongodb
kept given me Error: No such keg: /usr/local/Cellar/mongodb
. I was removing a mongodb-community.
use cd /usr/local/Cellar
then run ls -a
and then run rm -rf mongodb-community
to remove it
Upvotes: 11
Reputation: 51
I would suggest navigating into your /usr/local/Cellar
and run an ls -a
, I had a community version of mongo installed that wasn't being picked up by the command given above. If you find any mongo versions there just rm -rf
each instance
Upvotes: 4
Reputation: 1646
Run the following commands to remove mongodb from the launch/startup and to uninstall it using Homebrew:
# See if mongo is in the launch/startup list
launchctl list | grep mongo
# Remove mongodb from the launch/startup
launchctl remove homebrew.mxcl.mongodb
# Kill the mongod process just in case it's running
pkill -f mongod
# Now you can safely remove mongodb using Homebrew
brew uninstall mongodb
Just double-check in /usr/local/bin/
to make sure that the mongodb commands are removed.
Upvotes: 98