mongodbmacosterminal

Read-only file system when attempting mkdir /data/db on Mac


I am trying to create a new folder in the root directory.

I tried all kinds of examples.

sudo mkdir /data/db
sudo mkdir -p /data/db

I keep getting:

mkdir: /data: Read-only file system

Solution

  • If you have a Mac and updated to Catalina or more recent version, then the root folder is no longer writable.

    I just changed the directory somewhere else.

    Been using this command for now

    mongod --dbpath=/Users/user/data/db