This is an upcoming (i.e. in progress) version of the manual.

Install MongoDB Community Edition on macOS


Installing Release Candidates

This installation page refers to the upcoming MongoDB 4.2 GA version and not the release candidate available for testing; i.e. the procedure will not work for release candidates.


While the 4.2 release candidates are available, these versions of MongoDB are for testing purposes only and not for production use.

Instead, you can test the new upcoming 4.2 features in Atlas without the hassle of installing locally. Use Promocode: MONGODB4DOT2 for 200 USD credit.

Alternatively, to install the release candidate for testing, go instead to the MongoDB Download Center and manually download.

Select Version. 4.2.0-rc1
Select OS. Select your operating system.
Select Package. You can choosed to install just the server (i.e. mongod), the mongos, the tools (such as mongodump, etc), the mongo shell or a tgz of all the binaries.

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

Platform Support

MongoDB 4.2+ only supports macOS versions 10.12+ on Intel x86-64. See Supported Platforms for more information.

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 to the prerequisites and go to the Install MongoDB step.

Install Homebrew

OSX does not include the Homebrew brew package by default. Install brew using the official instructions.

Tap the MongoDB Homebrew Tap

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@4.2

In addition to the binaries, the install creates:

Run MongoDB

From a terminal, issue the following to run MongoDB (i.e. the mongod process) in the foreground.

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

Alternatively, to run MongoDB as a macOS service, issue the following (the process uses the /usr/local/etc/mongod.conf file created during the install):

brew services start mongodb-community@4.2

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:

Additional Considerations

Localhost Binding

Starting with MongoDB 3.6, MongoDB binaries, mongod and mongos, bind to localhost by default.

When bound only to the localhost, these binaries can only accept connections from clients that are running on the same machine. Remote clients cannot connect to the binaries bound only to localhost. For more information, including how to override and bind to other ip addresses, see Localhost Binding Compatibility Changes.