If your deployment does not use TLS connections
mongod --config /opt/homebrew/etc/mongod.conf --fork
# You can optionally specify the db path
mongod --dbpath /path/to/dbdir --logpath /path/to/mongodb.log --fork
To stop a mongod running as a background process, connect to the mongod using mongosh, and issue the shutdown command as needed
If your deployment uses TLS connections, use GNU Screen
# Start your screen
screen -S <name-of-screen>
# Start mongod
mongod --config /opt/homebrew/etc/mongod.conf
# Detach from screen
<Ctrl+a>, then <d>
# View all active screens
screen -ls
# start
brew services start [email protected]
# stop
brew services stop [email protected]