Skip to content

How to install MongoDB unto Apple M1.

Go to mongoDB website and download their community version of their product. Download not just the Community Server but also their MongoDB Tools. There are Shell, Compass and Db Tools. I initially had installed Mongosh inside tools inside /opt/mongodb after installing the Mongo Db engine directly inside /opt/mongodb. The remaining items are Compass and a special software called RoboMongo. This is a GUI interface to the connect to the mongoDB engine.

Location of MongoDB and Mongosh.

After those two items were installed, I had to configure the MongoDB engine and would very much like to run it using a config file rather than supplying the mongod command with tons of parameters. So i then worked on the configuration file to make some changes.

MongoDB Configuration.

fork : true doesnt seem to work and had resorted to false instead. The only other items on this install where i had to work on was giving those paths an ownership of the user who needed to be used in order to run these items. My mongodb.conf file is hiding inside my /opt/homebrew/etc location

sudo mkdir -p /usr/local/var/log/mongodb
sudo touch /usr/local/var/log/mongodb/mongod.log
sudo chown -R username:group /usr/local/var/log/mongodb

sudo mkdir -p /usr/local/var/mongodb
sudo chown -R username:group /usr/local/var/mongodb

sudo mkdir -p /var/run/mongodb
sudo touch /var/run/
sudo chown -R username:group /var/run/mongodb

# to run the MangoDB
/opt/mongodb/bin/mongod -f /opt/homebrew/etc/mongod.conf