MacOS switched root Mongodb data folder to system ownership and it cannot be changed back anymore
Solution 1:
I found out the reason for this nonsense. It's Apple.
Basically, what is happening here is that the new version of MacOS, which is Catalina, now has System root folder as read only. So any software that needs to use the root folder for whatever reason is screwed.
My solution was to do the following:
- Boot into recovery mode by shutting down the machine and starting it up via
Cmd + R + Boot
- Once in recovery open up the terminal
- Disable SIP using
csrutil disable
- Restart the machine
- When booted into MacOS Catalina open up the terminal
- Run
sudo mount -uw /
This will give you root access for the current session. It will be reset upon next start up. Though now you can do a lot of things in the root folder, like move your stuff elsewhere.
So what I've done is moved the whole /data
folder to /System/Volumes/Data
using this command: sudo mv /data /System/Volumes/Data
Apparently that is the preferred place to put all the data. And according to the new way that the root folder works you can have links for these folders so they would act as if they were part of the root folder. That, obviously, didn't work for me. However, I'm still able to run mongod
and setting the dbpath
as follows:
sudo mongod --dbpath /System/Volumes/Data/data/db
Hope this helps anyone who encounters this asinine decision by Apple. This whole Catalina update is a resounding mess.