MongoDB Fresh Install in Mac OS X

Today i need MongoDB for my project, and i forget that in my laptop don’t have MongoDB installed yet. lets get started to installing MongoDB in Mac OS X.

Download and extract
go to MongoDB Official website to download the package.
$tar xvz
$sudo mv /usr/local/mongodb

Add MongoDB data directory
$mkdir -p /data/db
$sudo chown user /data/db

Add MongoDB/bin $PATH
$vim ~/.bash_profile

export MONGO_PATH=/usr/local/mongodb

$source ~/.bash_profile
$mongo -version
MongoDB shell version: x.x.x

Starting MongoDB
Terminal 1
waiting for connections on port 27017

Terminal 2
MongoDB shell version: x.x.x
connecting to: test
> show dbs
local 0.00GB

Create AutoStart MongoDB

$ sudo vi /Library/LaunchDaemons/mongodb.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
<plist version="1.0">

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

try to start mongodb again by type:



Leave a Reply

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