6

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

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.

3
  • 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 '20 at 19:53
  • is it possible to avoid reboot? on aws it takes hours... Jul 29 '21 at 20:37
  • @DaneelYaitskov No.
    – jksoegaard
    Jul 29 '21 at 20:42
0

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)

sudo touch /etc/synthetic.conf
sudo chmod 0777 /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
4
  • Why make it executable with 0777? sudo will create it just fine on the third line. Why chmod/chgrp recursive with -R? It's a plain file, isn't it?
    – aMike
    Dec 12 '20 at 0:40
  • these are good points, 777 because it's in a protected location, i suppose it could be 766 or 222 but it's only temporary, and 777 is easy to write & understand :) Dec 15 '20 at 15:26
  • If etc/synthetic.conf does not already exist, then sudo touch /etc/synthetic.conf creates the file and has already set the owner:group to root:wheel thus making sudo chown root:wheel /etc/synthetic.conf not at all needed! Dec 15 '20 at 15:54
  • @MichaelDavidGieson How about the permissions on the target? Anything else that is needed like SIP?
    – mjs
    4 hours ago

You must log in to answer this question.

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