This version of the documentation is archived and no longer supported.

Install MongoDB Community Edition on macOS


The following tutorial uses brew to install MongoDB 3.4 Community Edition on macOS systems. To install a different version of MongoDB, please refer to that version’s documentation.

Platform Support

Changed in version 3.4.11: MongoDB now requires macOS 10.8 or later.

MongoDB requires macOS version 10.8 (Mountain Lion) or later running on an x86_64 processor.

Install MongoDB Community Edition


If you have the Homebrew brew package installed on your OSX host and you have previously tapped the official MongoDB Homebrew Tap, skip the prerequisites and go to the Install MongoDB step.

Install XCode

Apple’s XCode includes command-line tools that are required by brew, and is available for free on the App Store. Make sure you are running the latest version.

Install Homebrew

If you have previously tapped the official MongoDB formula repository, you can go directly to the Install MongoDB step.

Issue the following from the terminal to tap the official MongoDB Homebrew Tap:

brew tap mongodb/brew

Install MongoDB

From a terminal, issue the following:

brew install mongodb-community@3.4

In addition to the binaries, the install creates:

Run MongoDB

You can run MongoDB as a macOS service using brew, or you can run MongoDB manually as a background process. It is recommended to run MongoDB as a macOS service, as doing so sets the correct system ulimit values automatically (see ulimit settings for more information).

  • To run MongoDB (i.e. the mongod process) as a macOS service, issue the following:

    brew services start mongodb-community@3.4
  • To run MongoDB manually as a background process, issue the following:

    mongod --config /usr/local/etc/mongod.conf --fork

Both methods use the /usr/local/etc/mongod.conf file created during the install. You can add your own MongoDB configuration options to this file as well.

To verify that MongoDB is running, search for mongod in your running processes:

ps aux | grep -v grep | grep mongod

You can also view the log file to see the current status of your mongod process: /usr/local/var/log/mongodb/mongo.log.

Connect and Use MongoDB

To begin using MongoDB, connect a mongo shell to the running instance. From a new terminal, issue the following:


For information on CRUD (Create,Read,Update,Delete) operations, see: