1

I have an outdated version (1.8.2) of mongodb on OS X and I cannot for the life of me figure out how to get rid of it. It was installed several years ago, I think with homebrew. Upgrading it using brew update && brew upgrade mongo got me the newest version of the mongo client (2.4.9) but when I open the client and run

use admin
db.runCommand({buildInfo:1})

I get

{
  ...
  "version" : "1.8.2",
  ...
}

When I ask

which mongo

I get

/usr/local/bin/mongo

which is a symlink (as expected) to

/usr/local/Cellar/mongodb/2.4.9/bin/mongo

also

/usr/local/opt/mongodb

appears to be properly symlinked to

/usr/local/Cellar/mongodb

Looking in /usr/local/Cellar/mongodb, I found two outdated versions (one of them 1.8.2) and moved both of them to see what would happen. The answer is nothing. Mongo Client still starts and reports the client version to be 2.4.9, but db.runCommand({buildInfo:1}) still reports 1.8.2. I've uninstalled and reinstalled via homebrew, but just don't know where the culprit lies. Any help is be greatly appreciated.

0

4 Answers 4

4

Based on the fact you are running MongoDB in OS X, here are my assumptions:

  1. This is not a PRODUCTION system
  2. This is a sandbox, used to developand/or learn MongoDB.
  3. You are OK losing all the data you currently have on this MongoDB instance

If all of my 3 assumptions are true you can just go and manually delete all mongoDB executables. They should all probably in the same directory. Move that directory to the trash, as well as the contents of the dbpath and log path.

Running the getCmdLineOpts command in the mongo shell will help you identify both the dbpath and log path http://docs.mongodb.org/manual/reference/command/getCmdLineOpts/

This link has instructions for re-installing MongoDB: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/

Please let me know if you have any problems.

1
  • getCmdLineOpts looks like a useful thing to have in the toolbox, although the answer turned out to be a stubborn instance of mongod. I stopped it, unloaded it from launchctl, removed it from /Library/LaunchAgents and then restarted it and all seems well now.
    – Ben
    Feb 28, 2014 at 2:15
1

it's brew update and then brew upgrade mongodb not brew update mongo.

2
  • Thanks. That didn't turn out to be the answer, but can you tell me what the difference is between the two packages?
    – Ben
    Feb 28, 2014 at 2:10
  • I think it really comes down to which one you used to install it. I actually upgraded mine after seeing this question. I tried mongo and it didn't work and then tried mongodb and it worked.
    – lciamp
    Feb 28, 2014 at 2:17
1

Thanks for the input, you guys. The answer turned out to be a particularly stubborn version of mongod. It was set to start on system startup using launchctl, and so it persisted even though I restarted my machine. I removed it from launchctl as advised in this rather old post, then stopped mongod by running the following from the mongo shell:

> use admin
> db.shutdownServer()

After that I copied the homebrew mongo plist file from /usr/local/Cellar/mongodb/2.4.9/homebrew.mxcl.mongodb.plist into /Library/LaunchDaemons and ran

$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.mongodb.plist

Restarted the machine and all seems to be well running 2.4.9.

-1

In case you have an older version installed, it's a good idea to check the folder using ls /usr/local/Cellar

I had an installation under a folder called mongodb26 since I had manually chosen to work with MongoDB 2.6. In such a case just doing brew uninstall mongodb won't work. I had to do brew uninstall mongodb26. Just a little good thing to know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.