I'm trying to install Mongodb community server on macbook air with the new M1 chip following the official mongodb tutorial. However im running into this problem.
~ ❯❯❯ brew install [email protected]
Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
brew bundle dump
Any help with installing mongodb on m1 would be very helpful
MongoDB works as a distributed database and makes data access easy. There are two methods to install MongoDB on mac: Installing MongoDB using brew (recommended) Installing MongoDB by downloading from official website.
Go to the MongoDB website's download section and download the correct version of MongoDB. Run the Mongo daemon, in one terminal window run ~/mongodb/bin/mongod . This will start the Mongo server. Run the Mongo shell, with the Mongo daemon running in one terminal, type ~/mongodb/bin/mongo in another terminal window.
⚠️ Yes, Rosetta 2 only.
Article on how to install mongodb on apple m1 using homebrew
Install homebrew from https://brew.sh/
Install xcode command line using
xcode-select --install
Now to install mongodb use
brew tap mongodb/brew
brew install [email protected]
To check if mongodb has been installed use
mongo --version
to start mongoDB as macOS service use
brew services start [email protected]
and to stop mongoDB to run as a background service use
brew services stop [email protected]
Or, if you don't want/need a background service you can just run:
mongod --config /opt/homebrew/etc/mongod.conf
To run mongodb commands, open a new table and run
mongo
To check your databases run
show dbs
Full documentation here: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
I was getting the same problem, on the M1 MacBook Pro. I changed the terminal settings to Rosetta and then tried to install the brew.
For this process, tap with double fingers on the terminal and click on Get Info, and in the menu, click on Open using Rosetta.
Now restart the terminal again and try to install the brew again with this link in the terminal.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Now your brew is installed, use this to install MongoDB now, it will work smoothly. You can check the documentation for further process, as it won't make more issues: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With