Nix install breaks after every macOS Monterey update

Hey community,

I run nix on both a workstation and a MacBook with the m1. It has worked great until recently every time I update the Mac the /nix folder get’s removed. I do still have the volume but it has the incorrect path. Any ideas why this is happening?

df -hTP
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/disk3s1s1 apfs  461G  216G  246G  47% /
/dev/disk3s6   apfs  461G  216G  246G  47% /System/Volumes/VM
/dev/disk3s2   apfs  461G  216G  246G  47% /System/Volumes/Preboot
/dev/disk3s4   apfs  461G  216G  246G  47% /System/Volumes/Update
/dev/disk1s2   apfs  500M   21M  480M   5% /System/Volumes/xarts
/dev/disk1s1   apfs  500M   21M  480M   5% /System/Volumes/iSCPreboot
/dev/disk1s3   apfs  500M   21M  480M   5% /System/Volumes/Hardware
/dev/disk3s7   apfs  461G  216G  246G  47% /Volumes/Nix Store

What’s the content of /etc/synthetic.conf and /etc/fstab?

Which version of the Nix installer script did you use?

It was a while ago I think I just did the default on the website at the time.

  • /etc/fstab has been removed it appears
  • /etc/synthetic.conf just has nix in it

There’s a known (“normal”, unfortunately) problem with Apple overwriting /etc/zshrc on every update. See

Since there’s some uncertainty here, and I don’t think we’ve had any other reports of fstab being wiped by a macOS update, I would start from the assumption that this is what you ran into if your shell is zsh.

If you do (use zsh) I’d recommend following the uninstall instructions and then reinstalling nix: Installing a Binary Distribution. (And, when future updates replace the zshrc, follow the steps in the issue linked above).

If Apple is actually wiping fstab, I would expect we’ll have corroborating reports soon.


Thanks for this, I did a reinstall and it remounted the /nix volume at the correct location. Not sure why that was happening but I appreciate all the help. Could be one of those “work security policy” things…

Ah. I guess that’s possible. It isn’t the case here, but I know we’ve had at least a report or two about people with work machines that have policies that preclude mounting a volume entirely. Report back if fstab disappears after the next update?

I definitely will, this is the 3rd time I’ve had to run the reinstall but the last couple times it didn’t remove /etc/fstab.

1 Like

So far, I’ve only ever had to add these lines to the end of /etc/zshrc:

# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/' ]; then
  . '/nix/var/nix/profiles/default/etc/profile.d/'
# End Nix

Just copy it out of /etc/bashrc. Then open a new shell.

1 Like

Hey @hmpffff, definitely done this work around as well. Unfortunately, this one loses the /nix path so it can’t evaluate the nix-daemon script.

Yeah that’s because the Nix store isn’t getting mounted. You need the correct fstab for that.

Mine looks like this:

# Warning - this file should only be modified with vifs(8)
# Failure to do so is unsupported and may be destructive.
UUID=EA40A961-526A-430D-AC1B-4302414FF135 /nix apfs rw,noauto,nobrowse,suid,owners

Obviously, you’d need to replace the UUID with your Nix volume’s.