Setup MongoDB on macOS Catalina 10.15 and above

Coding In depth
Mac O’Clock
Published in
2 min readMay 2, 2020

--

I upgraded my computer to macOS Catalina and I am facing problems running MongoDB. As you all know Mongo puts its databases in /data/db. In the latest macOS Catalina, they have removed all access to the root folder. If you are updating from the previous versions, your file will be automatically moved under the Users folder.

This article explains how to quickly set up MongoDB on macOS Catalina.

  1. Install homebrew The Missing Package Manager for macOS!
brew install wget

2. Install MongoDB community version. While writing this article the latest MongoDB community version is 4.2.

brew install mongodb-community@4.2

3. Now create a data/db folder. This folder contains the MongoDB data file.

sudo mkdir -p /data/db

This command will create the below folder.

/Users/<username>/data/db

In the case of migrating from another system.Copy-paste all the files in the below directory.

4. Now open the terminal and run the following command. Run below command to bootstrap MongoDB. Here -dbpath is to set the path of your local folder where all the database files exist.

./mongod --dbpath…

--

--

Coding In depth
Mac O’Clock

Writing about Angular, React, JavaScript, Java, C#, NodeJS, AWS, MongoDB, and Redis related articles. Please follow, clap stories to motivate us writing more!