34

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. Commented Apr 13, 2020 at 19:15
  • How about creating the folder in /Users/Shared instead (that's prety much what it's there for)? Commented 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. Commented Apr 13, 2020 at 19:34
  • The other standard place is /usr/local Commented Apr 13, 2020 at 22:03

3 Answers 3

43

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 series of spaces.

After creating the file above with the specified contents, you need to run /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t or reboot the system. After rebooting, you'll see the /newfolder folder.

9
  • 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 Commented Apr 13, 2020 at 19:53
  • 3
    @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. Commented Sep 21, 2022 at 14:34
  • @cachius Sadly there is no other documentation than that in the man pages, if you know anything else about this can you please post it as an answer? Commented Jun 29, 2024 at 1:46
  • @CaptainMan Look at the man page of syntethic.conf (mirror) which is unfortunately not linked from man apfs.util Commented Jul 2, 2024 at 13:06
  • 2
    Man, thank you! Especially for the note about the tab and the apfs.util - both saved me hours of hair pulling Commented Mar 13 at 2:46
12

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 FOLDER_NAME='...' ACTUAL_PATH_TO_REAL_FOLDER='...' echo -e "${FOLDER_NAME}\t${ACTUAL_PATH_TO_REAL_FOLDER}" | sudo tee -a /etc/synthetic.conf sudo chmod 0644 /etc/synthetic.conf sudo chown root:wheel /etc/synthetic.conf /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t 

The apfs.util -t command should allow modifications without requiring a restart, but if it does not work then a restart should make the new entries appear at root.

3
  • 1
    echo -e "FOLDER_NAME\tACTUAL_PATH_TO_REAL_FOLDER" | sudo tee -a /etc/synthetic.conf Commented Sep 21, 2023 at 8:32
  • 1
    Also you have to restart the system to see these changes applied Commented Dec 19, 2023 at 19:20
  • 2
    @fatimasajjad Running /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t should be sufficient. Commented Jul 2, 2024 at 22:18
4

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 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.