Command Line – Directories Listed in /etc/synthetic.conf Not Accessible via the Link

catalinacommand linemacos

Background: Catalina removes access from the root filesystem. We can not create directories there even as sudo and even when disabling SIP. There appears to be a kind of workaround by using /etc/synthetic.conf.

Here is the contents of my /etc/synthetic.conf

  data    /Users/steve/data
  git     /Users/steve/git
  shared  /Users/steve/shared

I have created those directories under my home directory and rebooted.

$ls -lrta /Users/steve/data /Users/steve/shared
/Users/steve/data:
total 0
drwxr-xr-x    2 steve  staff    64 Apr 11 19:02 .
drwxr-xr-x+ 250 steve  staff  8000 Apr 13 11:29 ..

/Users/steve/shared:
total 0
drwxr-xr-x    2 steve  staff    64 Apr 11 19:02 .
drwxr-xr-x+ 250 steve  staff  8000 Apr 13 11:29 ..

$ls -lrta /Users/steve/data /Users/steve/gut
/Users/steve/git:
total 0
drwxr-xr-x    2 steve  staff    64 Apr 11 19:02 .
drwxr-xr-x+ 250 steve  staff  8000 Apr 13 11:29 ..

So those directories do exist ..

But then using the link from /etc/synthetic.conf does not work the way I had expected:

(base) 11:29:14/git $ls -lrta /data
ls: /data: No such file or directory

How is that association/link supposed to be used?

Update Permissions for /etc/synthetic.conf are

enter image description here

Best Answer

First make sure that you have created the file with the correct file permissions:

  Owner: root 
  Group: wheel

  Owner: read+write
  Group: read
  Everyone: read

Make sure that the two columns in your file are seperated by tab characters, and not just spaces.

Additionally the names of your existing folders probably need to be written without the leading slash. At least this is how the man page specifies it, and it is the only way I have tried it - it might work with a leading slash though.

I.e. you need to write Users/steve/data instead of /Users/steve/data.

Next ensure that you have rebooted your system after modifying or creating synthetic.conf. The links are only available after a reboot.