问题
I get the following error when I try to create the MongoDB data/db directory:
sudo mkdir -p /data/db
mkdir: /data/db: Read-only file system
回答1:
The remount didn't work for me (it requires Disabling SIP, which I didn't want to do) So instead I moved the mongo folder. You should have the old folder under the 'Relocated items' folder on your desktop so just copy it wherever you want (I moved it to my user folder) and then in the terminal go
mongod --dbpath /users/<username>/data/db/
hope this helps
回答2:
Problem because of Read-only file system in mac os catalina
Boot you mac system into recovery mode. (by bootup system with holding CMD+R).
Open terminal (Present in "Utilities" in the top left menu).
Just run command
csrutil disable
Restart your system and Bootup normally
Before doing any activity open terminal and run command.
sudo mount -uw /
Once this all done you can do write in root location
回答3:
See the following answer: https://superuser.com/questions/1458974/macos-switched-root-mongodb-data-folder-to-system-ownership-and-it-cannot-be-cha
You have to create the directory in /System/Volumes/Data
now.
来源:https://stackoverflow.com/questions/57979325/unable-to-create-mongodb-data-db-directory-on-macos-catalina