Install MongoDB on Mac OS X Yosemite

OS X Yosemite

Install MongoDB in our Mac is something simple and easy. There are two ways to install MongoDB under Mac OS X:

  1. Manually, through the official binaries
  2. Through Homebrew, the famous package manager for Mac OS

In this article we will approach the installation through the second option, Homebrew, mainly because this is the most easy and fast method to start working with MongoDB in our Mac


Step 1: Intall Homebrew package manager:

Paso: 2: Update the Hombrew packages database

Step 3: Install MongoDB

With this command you will install MongoDB from the binaries:

… but there are other available installation options. The most important are:

Check the MongoDB installation

Now you have MongoDB installed in your system, but before start working, lets see what has happened:

  • MongoDB has been installed in the directory: /usr/local/Cellar/mongodb/2.6.5
  • A new configuration file mongod.conf has been created automatically. This file should store the MongoDB run-time configuration and is available here: /usr/local/etc/mongod.conf. Lets take a look to this file:

    Now you’ll see where the logs will be stored in the file /usr/local/var/log/mongodb/mongo.log and the data path /usr/local/var/mongodb

Run MongoDB

To execute MongoDB you can use the next command from the terminal:

Or launch MongoDB in background followed by the command –fork

However, if you want to keep MongoDB running at any time,  even when you reboot the system, you should use the following commands:

In addition, you will be able to use the following modifiers to change the default configurations:

Start using MongoDB

From now, MongoDB is available in your system and you can start MongoDB Shell from anywhere. You just have to open a terminal and use the mongo command to start:

César Trigo

Backend Development Director @ Gigigo Group

You may also like...

1 Response

  1. September 17, 2015

    […] pretty easy to get mongo going with homebrew. Detailed steps are here. But before starting the mongo daemon we need to make a couple of changes to the configuration file […]

Leave a Reply