Skip to content

Instantly share code, notes, and snippets.

@barbietunnie
Created December 31, 2024 18:39
Show Gist options
  • Save barbietunnie/95ac2678bfa462c8fcc4d745c14756b5 to your computer and use it in GitHub Desktop.
Save barbietunnie/95ac2678bfa462c8fcc4d745c14756b5 to your computer and use it in GitHub Desktop.
Running MongoDB locally on Apple Silicion

Running MongoDB locally on Apple Silicion

Manually running as a background process

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

Running as a background macOS service

# start
brew services start [email protected]

# stop
brew services stop [email protected]

Helpful Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment