- Install MongoDB >
- Install MongoDB Community Edition >
- Install MongoDB Community Edition on macOS
Install MongoDB Community Edition on macOS¶
On this page
Overview¶
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¶
Prerequisites¶
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¶
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:
Install MongoDB¶
From a terminal, issue the following:
In addition to the binaries, the install creates:
- the configuration file
(
/usr/local/etc/mongod.conf
) - the
log directory path
(/usr/local/var/log/mongodb
) - the
data directory path
(/usr/local/var/mongodb
)
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:To run MongoDB manually as a background process, issue the following:
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:
You can also view the log file to see the current status of your
mongod
process: /usr/local/var/log/mongodb/mongo.log
.