- Add MongoDB's Homebrew source and install
brew tap mongodb/brew && brew install mongodb-community - Start it now and on every login
brew services start mongodb-community
Check it worked
- Ping it
mongosh --eval "db.runCommand({ ping: 1 })"You should see ok 1.
Undo it
- Stop and uninstall
brew services stop mongodb-community && brew uninstall mongodb-community
- Add MongoDB's official package sourceNeeds sudo
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list - Install MongoDBNeeds sudo
sudo apt update && sudo apt install -y mongodb-org - Start it now and on every bootNeeds sudo
sudo systemctl enable --now mongod
Check it worked
- Ping it
mongosh --eval "db.runCommand({ ping: 1 })"You should see ok 1.
Undo it
- Uninstall MongoDBNeeds sudo
sudo apt purge -y mongodb-org*
- Install MongoDB and its shell
winget install MongoDB.Server; winget install MongoDB.ShellIt's set up to run as a Windows service, starting automatically. Close and reopen PowerShell afterwards.
Check it worked
- Ping it
mongosh --eval "db.runCommand({ ping: 1 })"You should see ok 1.
Undo it
- Uninstall MongoDB
winget uninstall MongoDB.Server; winget uninstall MongoDB.Shell