user2517788 user2517788 - 2 months ago 6x
Bash Question

Installing and Running MongoDB on OSX

If someone can provide some insights here I would GREATLY appreciate it.

I am new to MongoDB, and (relatively) new to the command line.

I had a express/node.js app running on MongoDB locally successfully, but upon restarting my computer, I attempted to restart the Mongo server and it began giving errors and wouldn't start. Since then, I have re-installed Mongo several times only to find the same error occurring. this is what I am receiving:

privee:mongodb-osx-x86_64-2.4.6 jonlinton$ ./bin/mongo
MongoDB shell version: 2.4.6
connecting to: test
Mon Aug 26 14:48:47.168 Error: couldn't connect to server at src/mongo/shell/mongo.js:145
exception: connect failed

Am I missing a step? Should I be creating a config file? Some basic guidance would be really helpful. Thanks in advance for any insights.


Assuming you have created the data/db directory under bin after install.

  1. Start a terminal for your mongo server
  2. Go to <mongodb-install-directory>/bin directory
  3. Run the command


  4. Start a terminal for your mongo shell

  5. Go to <mongodb-install-directory>/bin directory
  6. Run the command (make sure you put the name of the database)

    ./mongo test