Skip to content

Instantly share code, notes, and snippets.

@ivanberry
Forked from adamgibbons/install-mongodb.md
Created May 28, 2018 02:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanberry/54a51dfa16e5e617dfc68594e4b0f855 to your computer and use it in GitHub Desktop.
Save ivanberry/54a51dfa16e5e617dfc68594e4b0f855 to your computer and use it in GitHub Desktop.
Install MongoDB on Mac OS X 10.9

Install MongoDB with Homebrew

brew install mongodb
mkdir -p /data/db

Set permissions for the data directory

Ensure that user account running mongod has correct permissions for the directory:

sudo chmod 0755 /data/db
sudo chown $USER /data/db

Run MongoDB!

iTerm buffer 1: mongod
iTerm buffer 2: mongo


Note: If you get something like this:

exception in initAndListen: 10309 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating

It means that /data/db lacks required permission and ownership.

Run ls -ld /data/db/

Output should look like this (gibber is directory owner and wheel is group to which gibber belongs):

drwxr-xr-x  7 gibber  wheel  238 Aug  5 11:07 /data/db/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment