I tried to create a directory under root (the directory when I open terminal)
sudo mkdir /dotenv
But the system says:
mkdir: /dotenv: Read-only file system
My OS is Catalina 10.15.2
Is there any way to create the dir? I need to run a node.js server locally which requires .env file in the /dotenv dir
You'll need to use mkdir dotenv
if you are at your profile root (which it appears you are). That was the only way I could get it to work (I am on Catalina 10.15.3
).
Using mkdir /dotenv
(notice the /
) I got the same error as you.
If you really want to, you can disable the read-only file system in Catalina by following these steps (which are also listed below).
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
csrutil status
command + R
, open the terminal in the recovery, so input csrutil diabled
.csrutil status
.Here are two methods:
you are root.
sudo mount -uw / so, you could mkdir or touch new file.
If you still can't read or write any, you maybe try this:
cd ~ # cd home directory sudo vim /etc/synthetic.conf # create new file if this doesn't exist
In the conf files, add new line
dotenv /User/xx/dotenv # Notice: the space between this two strings is tab
Restart, and you will find a link named /dotenv
in the root.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.