Mongo Db — Installing on mac

I started learning Mongo .. and i was installing and i could not do it properly first then i followed few step which made my day!.

I am using Mac and i am installing mongo DB using brew.

1.Update the brew

brew update

2. Installing Mongo DB

brew install mongodb

3.I got the error “Run `brew link` on these:

If you happen to get this error message, then just run this command in the terminal

brew link makedepend

then again, install the mongodb using brew install mongodb

4. Installing openssl, sometime it will be pre — installed.but its always better to run.

brew install mongodb –with-openssl

5.Creating the directory for mongo DB

mkdir -p /data/db

6. Setting up the permission to the directories.

sudo chmod 0755 /data/db

sudo chown $USER /data/db

That`s it! you have mongo on your mac.

To run the mongo,

1. In one terminal , write the command


2. Open a new terminal,in that terminal, write the command


That`s all!! you can start creating database or collection or documents.