Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Since macOS Catalina, the root drive is read-only. The solution is to create a separate APFS volume and a “synthetic” /nix directory which points to it:

# Check if /nix exists, if not:
echo 'nix' | sudo tee -a /etc/synthetic.conf
# this will create a "synthetic" empty directory /nix

# REBOOT so macOS sees the synthetic directory

# After rebooting, create an APFS volume for Nix
# make sure to replace disk1 with the correct disk number, if different.
sudo diskutil apfs addVolume disk1 APFSX Nix -mountpoint /nix
sudo diskutil enableOwnership /nix
sudo chflags hidden /nix  # Don't show the Nix volume on the desktop
echo "LABEL=Nix /nix apfs rw" | sudo tee -a /etc/fstab

# Install Nix as usual
curl | sh
Copy link

kubukoz commented Dec 26, 2020

If you're reading this in the future: the latest from OP (@EncodePanda):

Q: is this still the way?

A: @EncodePanda: Not anymore. Follow the official script from nixos website. It will fail but it will tell you something like “Oh, I see you running this on newest OSX, you should run this script instead”. Do what it tells you to do and it will work like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment