brew tap mongodb/brew
brew install mongodb-community@4.2
brew services start mongodb-community@4.2
To run MongoDB manually as a background process, issue the following:
mongod --config /usr/local/etc/mongod.conf --fork
To verify that MongoDB is running, search for mongod in your running processes:
ps aux | grep -v grep | grep mongod