Install MongoDB on Mac OS X

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

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

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:

mongod


Originally published at victorleungtw.com on October 9, 2015.

victorleungtw

Years of experience delivering enterprise projects with global stakeholders in banking, airline and gaming industries involving a broad range of technologies. Provide consulting services at both executive and operational levels, including strategy and data analysis. Lead web and mobile app development team with hands-on coding implementation. Manage projects as Certified Scrum Master with Agile techniques. Qualification with master degree in Computer Science and pursuing MBA degree in Finance.

Leave a Reply

Close Menu