Update Homebrew’s package database.
brew update
To install the MongoDB binaries, issue the following command in a system shell:
brew install mongodb
To install as a services :
brew services start mongodb
or as a standalone process:
mongod --config /usr/local/etc/mongod.conf