Install MongoDB on Mac OS X

Firstly, install homebrew, which is the missing package management tool for OS X:

ruby -e “$(curl -fsSL”

Then, update Formulae:

brew update

And install the mongodb:

brew install mongodb

To have launchd start mongodb at login:

ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

Then to load mongodb now:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist

Or, if you don’t want/need launchctl, you can just run:

mongod — config /usr/local/etc/mongod.conf

Also create the data directory.

sudo mkdir -p /data/db

Don’t forget to change permission:

sudo chown “whoami” /data/db

Finally start your database:


Originally published at on October 9, 2015.

By Victor Leung

Experience in software development, consulting services and technical product management. Understanding of business and technology with an MBA in Finance and a Master degree in Computer Science. AWS Certified Solution Architect with experience in building products from scratch and serving as a charismatic leader.

Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: