How to Install & Run MongoDB on M1 Macs
Get MongoDB running on your M1 Mac with these simple steps.

MongoDB (mongo) isn’t natively supported on the M1 processors as of this writing. If you use zsh like I do, you may come across an error like this when trying to run mongo on your machine: zsh: bad CPU type in executable: mongo
.
Gaah, that error freaked me out a little and I had to do a Google deep dive to figure out how to get mongo running on my machine. Here is what I found:
- To get mongoDB running on M1 macs, we need to use macOS’ Rosetta Translation Environment to run intel binaries.
Previous to Apple’s M1 Processors, Macs ran on the intel processor. Since many of the applications and software that we use are still running on intel, we need to use the Rosetta2 terminal to get these binaries to process.
This explains why when I was trying to use Insomnia, I got a message telling me to install Rosetta2 - I ignored the message and didn’t use Insomnia because I had no idea who Rosetta was and why I needed her on my machine 😅
- We need to use Homebrew to install mongoDB on our machines.
As of Feb 2021, Homebrew fully supports Apple Silicon (M1 Processor) with v3.0.0. You can see the release notes here.
- We need to run mongo using the Rosetta2 Terminal.
Personally, I prefer using iTerm with zsh, but if I need to use a separate terminal to run the DB, so shall I do.
Now, let’s get to the installations!
Step 1: Create a copy of your terminal
Go to finder > applications > terminal
, right click on the terminal and select duplicate
; this will create a new terminal for you to work with. Rename the new terminal to Rosetta Terminal
so you don’t get confused which is which.
Now, right click on the newly renamed rosetta terminal, and click get info and select open using Rosetta this will enable the Rosetta Translation Environment we need to run intel binaries.
when you open up the new Rosetta Terminal, you will be asked to download Rosetta, select yes and don’t ignore it like I did initially 😅
Step 2: Install mongo using Homebrew
If you don’t already have Homebrew on your machine, run this command in your terminal
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once you have homebrew installed, you can pretty much follow the instructions on mongo’s doc site using the Rosetta terminal … but why not add them here:
# install xcode clixcode-select --install
# download formulae for mongobrew tap mongodb/brew
#install mongobrew install mongodb-community@5.0
Step 3: Now that everything is installed, we can run mongo on our machine (finally!)
To run mongo, do the following:
# run mongo as a macOS servicebrew services start mongodb-community@5.0
# when you want to stop mongo as a service run thisbrew services stop mongodb-community@5.0
# verify mongo is running; the status code should be startedbrew services list
# connect and start using mongomongosh
Remember to run these commands in the Rosetta Terminal!
And there you have it - mongo is now running on your machine.
Happy coding!
Kedasha
Resources:
- someone had same error: https://www.mongodb.com/community/forums/t/zsh-bad-cpu-type-in-executable-mongo/97260
- install mongo on m1: https://www.youtube.com/watch?v=f3iFaiBGVYw
- create new rosetta terminal: https://www.youtube.com/watch?v=9W8rTTE1WEA
- Mongo’s doc site: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
- article I found later on: https://andyfeng.medium.com/how-to-install-and-run-mongodb-on-m1-macs-1ed57b570fb6
-
How I Migrated from WordPress to Astro
-
5 FREE Courses to Master AI & ML Skills
-
How to Train ChatGPT to write like you
-
Ruby for Beginners: Your Complete Study And Installation Guide
-
What's the best Programming Language to Learn?
-
How to Install & Run MongoDB on M1 Macs
-
Automate macOS setup with a brewfile
-
From Social Worker to Software Engineer 💃
-
My First Three Weeks at Coding Bootcamp as a PT Student
Related:
Written by

Kedasha Kerr
Software Developer
in Chicago