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.

  1. Mongodb Mac Os Catalina Update

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.

Copy the following two lines of code and append at the end of the file. Save the changes, press CTRL + S. Restart the terminal, or read and execute the.bashprofile file again. If the installation is successful, the following command will give the version of MongoDB just installed on your system. A guide to show you how to install MongoDB on Mac OS X. 问题I have installed mongodb on my mac Catalina 10.15. I have php7.3 version installed as well. Second, find the MongoDB tap. Brew tap mongodb/brew Third, install MongoDB. Brew install mongodb-community MongoDB is now installed on your computer. Preparations (Before MacOS Catalina) Before you can use MongoDB, you need to create a /data/db folder on your computer to use MongoDB. You can create this folder with the following command.

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

Steps to Install MongoDB locally

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

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

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:

You should see something like:

This means you did it!

Mongodb Macos CatalinaMongodb Macos Catalina

I recently bought a new iMac and moved all of my files over using Time Machine. The migration went really well overall and within a few hours I had my development machine up and running. After starting an application I’m building I quickly realized that I couldn’t get MongoDB to start. Running the following command resulted in an error about the data/db directory being read-only:

I tried every chmod and chown command known to man and woman kind, tried manually changing security in Finder, compared security to my other iMac (they were the same), and tried a bunch of other things as well. But, try as I might I still saw the read-only folder error when trying to start the server….very frustrating. I found a lot of posts with the same issue but they all solved it by changing security on the folder. That wasn’t the problem on my machine.

After doing more research I found out that Catalina added a new volume to the hard drive and creates a special folder where the MongoDB files need to go. The new folder is:

The MongoDB files can then go at:

I ran the following commands to install the latest version of MongoDB using Homebrew (see https://github.com/mongodb/homebrew-brew for more details):

I then went into the MongoDB config file at /usr/local/etc/mongod.conf. Note that it’s possible yours may be located in a different location based on how you installed MongoDB. I changed the dbPath value to the following and copied my existing DB files into the folder:

Finally, I made sure my account had the proper access to the folder by running chown (something I had tried many times earlier but on a folder outside of /System/Volumes/Data):

After that I was able to start MongoDB and everything was back to normal. Hopefully this saves someone a few hours – I wasted way too much time on the issue. 🙂

Macos

Mongodb Mac Os Catalina Update