Mongodb Macos Catalina

If you are like me, running mongo servers on cloud IDE’s is just not the same as the customizations I have in my visual studio code. The need to test MongoDB servers locally sounds like an ideal option but I was running into issues trying to get the darn thing installed.

All the guides I found were over a year old and focused on OS-X or El Capitan. This one should work for Mac OS Catalina. This is an attempt to capture how to install MongoDB and run the Mongod (MongoDB Daemon) in some personal notes that may help someone in the future (at least myself). Originally, I tried following various installation guides that all failed to find the formula and ran into odd errors about directories that didn’t exist is read-only. My hope is that this will be a good reference for you.

If you are running Catalina, the old way of changing permissions for data/db don’t work !

Mongodb Mac Catalina

Steps to Install MongoDB locally

Mongodb

Create/open a project or clone a repo then head to the folder above that one.

Macos Catalina Mongodb

First, you need brew installed. You can find instructions for that here: https://brew.sh/, then run:

Install Mongodb Macos Catalina

Seriously, it’s that easy. No need to run chmod like on other setups, you now have mongod and mongo running. You can test this by running:

Mongodb Mac Os Catalina System

You should see something like:

Mongodb Mac Os Catalina Update

This means you did it!

Mongodb Mac Os Catalina Download

However, if you are using latest Mac version Catalina then the root folder is no longer writable. Brew has an updated version of mongodb to use a new path (which it creates itself), /usr/local/var/mongodb and following these instructions will fix the issue: Follow the link to install and update mongodb-community-edition. Brew services start mongodb-community@4.2. Brew services stop mongodb-community@4.2. Assuming that you installed HomeBrew and downloaded Mongo Database Community Edition 4.2. Hopefully, this helped to resolve the issue of getting /data/db not found issue when you run mongod process in Mac OS X first itme.