ref – http://www.mkyong.com/mongodb/how-to-install-mongodb-on-mac-os-x/
Moving files
First download the mongo database file from its website. Be default, your mac should put it into your ~/Download folder. Then open up a terminal.
You cd into the download directory. Then you unzip the tgz file. Then you move the folder into directory /usr/local/mongdb
cd ~/Download
$ tar xzf mongodb-osx-x86_64-2.2.3.tgz
$ sudo mv mongodb-osx-x86_64-2.2.3 /usr/local/mongodb
You should now see the mongodb folder with bin and data in the directory /usr/local/mongdb.
data/db folder
By default, MongoDB write/store data into the /data/db folder, you need to create this folder manually and assign proper permission. We make the directory, then check who the current User is. Then give permission to the current user for directory /data/db
$ sudo mkdir -p /data/db
$ whoami
rickytsao
$ sudo chown rickytsao /data/db
Now, the directory /data/db is ready for mongodb data writes.
.bash_profile file
Now we need to open up our .bash_profile and add a PATH entry. This is so that we can run mongod, and mongo from the /usr/local/mongodb/bin directory without having to type out the whole path.
$ cd ~
$ pwd
/Users/rickytsao
$ touch .bash_profile
$ vim .bash_profile
Then type in the following into the .bash_profile file:
export MONGO_PATH=/usr/local/mongodb
export PATH=$PATH:$MONGO_PATH/bin
restart terminal, then:
$ mongo -version
MongoDB shell version: 2.2.3
In terminal 1:
$ mongod
MongoDB starting : pid=34022 port=27017 dbpath=/data/db/ 64-bit host=mkyong.local
//…
waiting for connections on port 27017
In terminal 2:
$ mongo
MongoDB shell version: 2.2.3
connecting to: test
> show dbs
local (empty)
If you happen to get a “rlimits warning”, just type just type “ulimit -n 2048” or use something higher.
Using Mongoose
npm install mongoose –save