When executing sudo mkdir xxx in the root directory of macOS Monterey, the error message Read-only file system is returned.
For security and protection purposes, Apple has restricted the ability to create files in the root directory starting from macOS Big Sur. Even if you use sudo with root privileges, you cannot create files directly in the root directory.
However, Apple has provided a workaround solution using Firmlinks, a link mechanism similar to Unix symbolic links, that can satisfy specific user requirements without compromising the system.
Many online solutions require users to restart the computer and enter recovery mode, which is complicated. This article introduces a more convenient and secure solution that can be done in just two steps (or strictly speaking, just one step).
This solution does not require entering the security mode.
1、Execute “sudo vi /etc/synthetic.conf” in the terminal and add the following content to the end of the “synthetic.conf” file and save it:
2、After restarting the computer, you can see a new “/photo” directory in the root directory.
a. “photo” at the beginning is the name of the file you want to create in the root directory, which can be named according to your needs.
b. The separator in the middle is a tab (the tab key in the upper left corner of the keyboard) and not a space.
c. The last “photo” is a real file that is created in your user’s home directory.