Installing MongoDB on macOS

To install MongoDB on macOS (if you have Homebrew installed (https://brew.sh/):

brew tap mongodb/brew

This will clone the github repo. Once the command finishes you can issue the command to install mongodb-community. The following will install the latest version of the community edition.

brew install mongodb-community

In order to start the mongo service and restart on login run the following: –

brew services start mongodb/brew/mongodb-community

If you don’t want to run as a background service then run:

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