MongoDB Catalina Read and Write

Viewed 626

I used chown It doesn't work.

Bilals-MBP:~ $ sudo mkdir -p /data/db
Password:
mkdir: /data/db: Read-only file system

I am not able to get Read and write permission I am using Catalina 10.15 maybe that's the problem ?

I downloaded MongoDB from Homebrew and I am able to see version on on command shell the only problem is whenever I use mongod then throws error and says Access is not allowed

2 Answers

I found a solution. After Catalina update Mac doesn't let us change permissions on /usr folder so we need to change directory of /data/db folders –

sudo mkdir -p /System/Volumes/Data/data/db

try this path if you also having same issue I have tried and worked for me.

This is what they said in their docoumentation:

Starting with macOS 10.15 Catalina, Apple restricts access to the MongoDB default data directory of /data/db. On macOS 10.15 Catalina, you must use a different data directory, such as /usr/local/var/mongodb.Starting with macOS 10.15 Catalina, Apple restricts access to the MongoDB default data directory of /data/db. On macOS 10.15 Catalina, you must use a different data directory, such as /usr/local/var/mongodb.

what you should do instead

1- Create the data directory.

sudo mkdir -p /usr/local/var/mongodb

2- Create the log directory.

sudo mkdir -p /usr/local/var/log/mongodb

3- Set permissions for the data and log directories.

sudo chown my_mongodb_user /usr/local/var/mongodb
sudo chown my_mongodb_user /usr/local/var/log/mongodb

you can see here the Full Documentation

Related