Learn how to install and configure MongoDB on your local machine for development.
Install MongoDB using Homebrew:
# Install Homebrew if you haven't already
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install MongoDB Community Edition
brew tap mongodb/brew
brew install mongodb-community
# Start MongoDB service
brew services start mongodb-community
# Verify installation
mongosh
# Verify installation by opening MongoDB Shell
"C:\Program Files\MongoDB\Server\[version]\bin\mongosh.exe"
# Default installation directory
C:\Program Files\MongoDB\Server\[version]\
# Import MongoDB public GPG key
curl -fsSL https://pgp.mongodb.com/server-6.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor
# Create list file for MongoDB
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
# Update package list
sudo apt-get update
# Install MongoDB
sudo apt-get install -y mongodb-org
# Start MongoDB
sudo systemctl start mongod
# Enable MongoDB on system startup
sudo systemctl enable mongod
# Verify installation
mongosh