Install MongoDB in OS X Mac PC

Download and Unzip MondoDB

To install MongoDB on your Mac PC (OS X) first you have to download MongoDB. Go to the official MongoDB website https://www.mongodb.org/downloads and download.

Now extract the zip.

Commands:

Create a DB folder

MongoDB stores data in a folder named data/db. By default this directory will not be created. So manually we should create this directory.

I assume you are logged in with root. If not, make sure the user have proper permission in  data/db directory.

Start MongoDB

If your data/db folder is in default location just run:

Else run

If everything is properly done, MongoDB should start.

capture1

Don’t Close this terminal and open another terminal. In this new terminal run:

The MongoDB will open in the command prompt and you can write your commands/queries here.

capture

Enjoy the new installed DB. For any questions please leave a comment.

Arijit Naskar

Arijit Naskar is a Software Developer and QA, also founder of alltechstories.com a popular tech tutorial & how-to website since 2014. He loves to explore new technologies and writing blogs.

You may also like...