Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uninstall MongoDB on Mac OS X

Tags:

mongodb

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!

like image 741
jasenlew Avatar asked Jul 03 '14 07:07

jasenlew


People also ask

How do I start MongoDB from terminal?

Run the Mongo daemon, in one terminal window run ~/mongodb/bin/mongod . This will start the Mongo server. Run the Mongo shell, with the Mongo daemon running in one terminal, type ~/mongodb/bin/mongo in another terminal window. This will run the Mongo shell which is an application to access data in MongoDB.

How do I start MongoDB on Mac?

Once you are assured that your MongoDb directory has all the required permissions, open the terminal application on your Mac and type the command, ~/mongodb/bin/mongod to start the Mongo Server. In another terminal window, type the command ~/mongodb/bin/mongo in order to start the Mongo Shell.


1 Answers

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.

like image 149
Anuvrat Tiku Avatar answered Oct 03 '22 20:10

Anuvrat Tiku