brew download mongodb code example
Example 1: install mongodb on mac
brew install mongodb-community@4.2
#Step 2
Example 2: run MongoDB manually as a background process macos
mongod --config /usr/local/etc/mongod.conf --fork
brew install mongodb-community@4.2
#Step 2
mongod --config /usr/local/etc/mongod.conf --fork