Note: If you encounter any issues during installation, you can consult the additional documentation available on the MongoDB website.
From your macOS Terminal, install the Xcode command-line tools:
xcode-select --install
If you don’t already have the Homebrew brew
package on your machine,
follow the instructions found here to install it:
Homebrew install
Once you have brew
installed, enter the following commands from
the macOS Terminal:
brew tap mongodb/brew brew update brew install mongodb-community@8.0
Note: If you receive an error message saying that brew
is
not found, try entering the following command:
eval $(/opt/homebrew/bin/brew shellenv)
Run MongoDB as a macOS service by entering the following command:
brew services start mongodb-community@8.0
Note: If macOS gives you a security error, do the following:
Open System Preferences and select the Security and Privacy pane.
Find the General tab, where you should see a message about
mongod
.
Click the button to the right of that message. It will be labelled either Open Anyway or Allow Anyway.
To verify that MongoDB is running, enter the following from the Terminal:
brew services list
You should see that mongodb-community
is started.
Notes:
If you already have MongoDB installed but don’t have MongoDB Compass, we recommend that you uninstall your current version of MongoDB and install the latest version using the steps above before you attempt to install Compass.
If you encounter any issues during installation, you can consult the additional documentation available on the MongoDB website.
Here are the steps:
If you are on an M1 machine:
If you have macOS Big Sur or a more recent version of macOS, you can precede to Step 2.
If you have a version of macOS that is earlier than macOS Big Sur, you will need to manually install another tool called Rosetta by following the instructions found here.
Go to the MongoDB Download Center.
Make sure that you are in the section of the page entitled MongoDB Compass Download and that the following options are selected:
Click the Download button, and wait for the download to complete.
Double-click on the downloaded .dmg
file to open the disk image
in macOS Finder.
Drag MongoDB Compass to your Applications folder.
Eject the disk image.
From your Applications folder, double-click on the icon for MongoDB Compass to start it. (If needed, adjust your security settings so that Compass has the permissions needed to run.)
In the New Connection window in MondoDB Compass, you should see an option that includes the term “localhost”, which is the MongoDB server that is running in the background on your machine.
Click the Connect button.
Last updated on November 16, 2024.