Step 1: Create a new terminal that opens using Rosetta
- Open Finder and search for “Terminal”, then scroll down until you find the terminal icon.
- Right click on the terminal icon and select “Duplicate”. Rename your duplicate terminal “Rosetta Terminal”.
- Right click on “Rosetta Terminal” and select “Get Info”. Check the option to “Open using Rosetta”, then click “x” to dismiss the modal.
- (Optional) Drag the new “Rosetta Terminal” into your dock so you have easy access to it later. Another quick way to find this later is the invoke Spotlight Search via “command + space”, then search for “Rosetta”.
Step 2: Install MongoDB
- Open “Rosetta Terminal” and run the following to install Homebrew (this will take a few minutes to compete)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- After that’s completed, run
brew tap mongodb/brew
The next step can take a few minutes to complete — Go to this page first to check if mongodb-community@5.0
is still the latest version.
- Run
brew install mongodb-community@5.0
to install MongoDB.
Step 3: Start Mongod
- In “Rosetta Terminal”, run
sudo mongod --dbpath /usr/local/var/mongodb/
This also works in your normal (non-rosetta) terminal.
(Optional) If you get an error when running the above command, then it’s likely due to Mongo being installed in a different directory. To check which directory it’s installed in, run brew --prefix
. See this for more details.
If the output is “/opt/homebrew” then the command to start Mongod on your machine should be:
sudo mongod --dbpath /opt/homebrew/var/mongodb