![macOS - How to Create a new Directory in Root Directory (/)?](https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/39Iz5xge4sE/upload/d75367924872b70ad697324017b34538.jpeg)
macOS - How to Create a new Directory in Root Directory (/)?
![Sasivarnan R](https://cdn.hashnode.com/res/hashnode/image/upload/v1687859447092/XXhOOjMok.png)
Tried to create a new directory at root directory of macOS but received an error - mkdir: folder-name: Read-only file system
?
Starting with macOS Catalina (version 10.15+), the root mount point is read-only, so physical files cannot be created at this location.
However, we can use virtual symbolic links to directories that exist outside of the root.
To do this, create a new file at /etc/synthetic.conf
and add the following line to it:
log Users/sasivarnan/log
The log
part is the name of the virtual folder that needs to be created in the root directory, and the Users/sasivarnan/log
part is the path where the actual folder on disk. The folder must already exist in that path.
Note:
-
The space between the two folder names is a
tab
, not aspace
. -
The virtual folder can be placed anywhere on disk, not just in the Users directory.
After creating the file, reboot your system. The /log
folder will then appear in the root directory.