54

After the installation of Catalina all User created folders from root are moved into a separate folder and the root folder is made readonly, containing only system default folders.

How is it possible to undo this and to make the root folder writeable again?

user3439894
  • 58,676
  • Are you looking to persist this change across reboots of the OS or just gain permission one time to make some changes? – bmike Oct 14 '19 at 11:03
  • Can you explain exactly what you want to achieve? Are there specific files that you want to add to the root? Any reason that these files cannot operate from another location? Or do you want to modify existing system files? – benwiggy Oct 31 '19 at 11:57
  • 2
    @benwiggy My use case is that I simply want to create a shorter path for the files I use for development. It's much easier to type cd /devel/myproj than cd /Users/medington/devel/myproj. The synthetic directories are exactly what I want to do that. – Mark Edington Nov 23 '19 at 18:27
  • If you just want shorter names to cd to, just add them to your CDPATH (bash, probably others). Then, you can just type cd myproj. No need to try to work around changes to the OS. (And I just noticed this is over two years old. Oh well.) – aMike Apr 10 '22 at 22:46

3 Answers3

64

You can create a symbolic in root directory via synthetic.conf. For example, consider creating a symbolic link named data at /, which points to ~/data

mkdir ~/data
echo -e "data\tUsers/$USER/data" | sudo tee -a /etc/synthetic.conf

After executing the command above, you need to reboot to see effects.

SEE ALSO

man synthetic.conf
Shawyeok
  • 756
  • 1
  • 4
  • 6
  • 4
    Really oversubtle to call this "... your root volume will be writeable again" considering that the man explicitely mentions that: The synthetic entities [...] are not physically present on the disk, but when the system is booted, they behave as if they were within certain parameters..." – klanomath Oct 14 '19 at 11:43
  • 7
    Safer solution than disabling SIP – Sai Surya Kattamuri Oct 16 '19 at 03:28
  • 10
    The question asked was "How to make root volume writeable again in Catalina?" - This does not make the root volume writable again! – user3439894 Oct 16 '19 at 16:23
  • 6
    I think this is the right solution proposed by Apple to be able to write in the root volume. So I would accept the question as valid. Thanks @Shawyeok for sharing it. – Peter Gibbons Oct 17 '19 at 11:35
  • 1
    @Peter Gibbons, This does not make the root volume of the Macintosh HD writable again as in previous versions of macOS! All this does is allow the system to create a user defined symlink to a file in /System/Volumes/Data in the root of the Macintosh HD. It is still not writable to the user as in previous versions of macOS. It is a good workaround, but that is all that it is. – user3439894 Oct 17 '19 at 14:49
  • For some strange reason this is not working for me at all :( dev System/Volumes/Data/dev - it shows no folder in the system file at all. – jumpcutking Oct 27 '19 at 14:52
  • @JustinKaz Did you separated by a tab character? – Shawyeok Oct 27 '19 at 14:56
  • @Shawyeok Yes. Even ensured it by using nano. – jumpcutking Oct 27 '19 at 15:01
  • @JustinKaz Make sure your target folder /System/Volumes/Data/dev is exists. – Shawyeok Oct 27 '19 at 15:09
  • Yep - did a go to the folder on that exact path and it opens no problem. Just rebooting doesn't add the synthetic folder to the root. @Shawyeok - I'm trying a different name – jumpcutking Oct 27 '19 at 15:13
  • @Shawyeok It hates the "dev" keyword so using "devl" worked - now the folder exists (symb link). – jumpcutking Oct 27 '19 at 15:17
  • Right, /dev folder is already exists in root directory. – Shawyeok Oct 27 '19 at 15:19
  • @Shawyeok it must be a hidden folder but that makes sense. – jumpcutking Oct 27 '19 at 15:52
  • 2
    @JustinKaz it's not hidden, but nor is it present under /System/Volumes/Data. If you run ls -l / you'll see dev listed. It's apparently already a "system defined" synthetic directory. – Mark Edington Nov 23 '19 at 18:31
  • No, it's just the mount point for devfs. It doesn't show up in Finder because it's hardcoded to not be shown. – saagarjha May 07 '20 at 18:11
  • hi, i need to install some extension on MacOS Catalina and I'll trying then enabled writing to /System/Library/Extensions/ by doing it:

    sudo mount -uw /

    sudo chown :admin /System/Library/Extensions/

    sudo chmod 775 /System/Library/Extensions/

    But i can't disable csrutil, is possible to enable the installation using this method i try with:

    echo -e 'Extensions\tSystem/Library/Extensions' | sudo tee -a /etc/synthetic.conf

    but the package can't install.

    How i do to make this folder writable?

    – ALEXANDER LOZANO Jul 02 '20 at 09:29
18

Found this thread at Apple Developer Forums, where they do make their root directory writable again. This is not persistent across reboots, so you might want to create an script that runs at startup to make the change be permanent (don't think this is necessary but would be a way out).

Original Answer:

  1. Disable SIP (recovery mode, csrutil disable).

  2. Restart.

  3. Mount drive for read and write (sudo mount -uw /).

  4. Assign rights for read and write ([sudo] chmod - R 775 /your/folder/).

  5. Delete it ([sudo] rm -rf /your/folder/).

  6. Restart.

  7. Enable SIP (recovery mode, csrutil enable).

"sudo" in square brackets means it may be required (like in my case) while others report they managed to get result without it.

xtealer
  • 306
5

How to create a /bar directory you can write to:

  1. echo 'bar' | sudo tee -a /etc/synthetic.conf
  2. reboot
  3. Run the following commands:
sudo diskutil apfs addVolume disk1 APFSX Bar -mountpoint /bar
sudo diskutil enableOwnership /bar
sudo chflags hidden /bar  # Don't show the Bar volume on the desktop
echo "LABEL=Bar /bar apfs rw" | sudo tee -a /etc/fstab

You might need to use a different diskX number. Check diskutil list for more.

Credit to @callahad on the NixOS/nix issue tracker: https://github.com/NixOS/nix/issues/2925#issuecomment-539570232

Dale Wijnand
  • 159
  • 1
  • 2
  • 1
    That's basically using synthetic.conf to make an empty directory (to be used as a mountpoint). Then it is creating a new volume at the mountpoint and mounting it in the root filesystem table. I think this is what the system is doing internally, but I am not clear if it's Apple supported or whether it will be durable over OS upgrades. – ingyhere May 30 '20 at 03:26
  • TCC will let you live your life with tricks like this... creating a new volume where you can be free. Userland apps can also do surprising things within the rules... like make files as root and but also the current user... I managed to FUSE mount without disabling SIP, for now. – Ray Foss Dec 15 '20 at 19:49