20

I am running macOS 10.15.4 and I need to create a non-user specific folder at the based of primary volume (Macintosh HD), but Finder does not allow me (option greyed out) and from the terminal I get denied.

From terminal:

mkdir /MyFolder
mkdir: /MyFolder: Read-only file system

Can anyone explain how this can be done? It was definitely possible in the past, before Catalina.

4
  • 1
    As the error noted, the system is now read-only, so the only thing you can do is disable that (not recommended) or fake it - see the synthetic.conf man page for synthesizing a mount point at the root folder.
    – red_menace
    Apr 13, 2020 at 19:15
  • How about creating the folder in /Users/Shared instead (that's prety much what it's there for)? Apr 13, 2020 at 19:18
  • I'll take a look at synthetic.conf. Turns out there is /System/Volumes/Data/, but it is a shame Apple didn't opt to make a unified view in the Finder. The /Users/Shared folder might be okay for some stuff, but for /Servers/ (one of the folders) which should be root only is not ideal and also conceptually out of place.
    – Andre M
    Apr 13, 2020 at 19:34
  • The other standard place is /usr/local
    – mmmmmm
    Apr 13, 2020 at 22:03

4 Answers 4

23

In Catalina the primary volume is read-only. This means it is not immediately possible to create new folders here.

In order to get around that, the system provides what is known as synthetic firm links. This allows you to create what appears to be folders at the root of the file system.

You need to create the file /etc/synthetic.conf, which should be owned by root and group wheel with permissions 0644.

The contents should look like this:

newfolder     Users/foo/bar

"newfolder" is the name of the virtual folder that will be created in the root of the file system. "Users/foo/bar" is the actual location of the folder. You need to ensure that this folder actually exists. It doesn't need to be inside Users, but can be anywhere in your system.

NOTE: It is important to ensure that the space between the two folder names is a TAB character, and not just a number of space.

After creating the file above with the specified contents, you need to reboot the system. After rebooting, you'll see the /newfolder folder.

2
  • Thanks. BTW per trying it out myself, there is no need for recovery mode to create /etc/synthetic.conf, but a reboot is necessary for changes to take impact. I created the new folder in System/Volumes/Data, per other suggestions. I was caught out by the tab separator, Also Apple KB entry on this change: support.apple.com/en-ca/HT210650
    – Andre M
    Apr 13, 2020 at 19:53
  • @DaniilIaitskov /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t stitches and creates synthetic objects on root volume group according to man apfs.util, since macOS 11 Big Sur.
    – cachius
    Sep 21, 2022 at 14:34
2

Here's a copy and paste for terminal to set this up:

# Be sure to change:
# FOLDER_NAME   - the root folder name. 
# ACTUAL_PATH_TO_REAL_FOLDER - the path to the "real" folder.
# 
#    Example: 
#    "Drives    Users/bob/Documents/Drives"
#    .......^ this is tab (not spaces)
#    Both of FOLDER_NAME and ACTUAL_PATH_TO_REAL_FOLDER are not starting with /

sudo touch /etc/synthetic.conf
sudo chmod 0666 /etc/synthetic.conf
sudo echo "FOLDER_NAME  ACTUAL_PATH_TO_REAL_FOLDER" >> /etc/synthetic.conf
sudo chmod 0644 /etc/synthetic.conf
sudo chown root:wheel /etc/synthetic.conf
0
1

According to man synthetic.conf:

Because the root mount point is read-only as of macOS 10.15, physical files may not be created at this location. All writeable paths must reside on the data volume, which is mounted at /System/Volumes/Data.

As a work around, the documentation suggests to use /etc/synthetic.conf to create virtual symbolic links or empty directories at the root mount point.

Three examples (via man page)

In each case, append the following to /etc/synthetic.conf

# example 1: create an empty directory named "foo" at / which may be mounted over
foo

# example 2: create a symbolic link named "bar" at / which points to
# "System/Volumes/Data/bar", a writeable location at the root of the data volume
bar   System/Volumes/Data/bar

# example 3: create a symbolic link named "baz" at / which points to "Users/me/baz"
baz   Users/me/baz

Note: the words must be separated by tabs. Unfortunately, StackOverflow renders tabs as spaces.

Automation

echo -e "baz\tUsers/me/baz" | sudo tee -a /etc/synthetic.conf
-1

solved with this link

youtube.com/watch?v=qIP0WE2ra18

1
  • 1
    Link only answers are often removed. We encourage you to list out the answer so that link rot doesn't break the knowledge. Also, text is far, far, far more accessible than a video on an external site. Welcome to Ask Different and thanks for the contribution.
    – bmike
    Apr 19 at 18:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .