I'm writing this gist for my own records but it might help someone else too.
Support for Catalina has improved a lot since the update was first rolled out.
Note: See the NixOS manual for discussion of the --darwin-use-unencrypted-nix-store-volume
option.
-
Run
sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --no-daemon
-
Run
sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
-
Remove the mount from
/etc/fstab
by runningsudo vifs
and deleting the line
LABEL=Nix\040Store /nix apfs rw,nobrowse
. -
Delete the APFS volume using
diskutil
diskutil apfs deleteVolume <volumeDevice>
Note: volumeDevice
can be found by running
diskutil apfs list
-
Remove the synthetic empty directory for mounting at
/nix
by runningsudo vim /etc/synthetic.conf
and deleting the line
nix
. -
Reboot the system for changes to take effect.
-
Run
echo "removing nix files" sudo rm -rf /nix rm -rf ~/.nix-profile rm -rf ~/.nix-defexpr rm -rf ~/.nix-channels rm -rf ~/.nixpkgs rm -rf ~/.config/nixpkgs rm -rf ~/.cache/nix
to remove all remaining
Nix
artifacts from the system.
Note: There may also be references to Nix
in the shell configurations files under your home directory (e.g. ~/.profile
, ~/.bash_profile
, ~/.zshenv
, etc.) which you may remove.
-
Kill the daemon process by running
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
-
Remove the mount from
/etc/fstab
by runningsudo vifs
and deleting the line
LABEL=Nix\040Store /nix apfs rw,nobrowse
. -
Delete the APFS volume using
diskutil
diskutil apfs deleteVolume <volumeDevice>
Note: volumeDevice
can be found by running
diskutil apfs list
-
Remove the synthetic empty directory for mounting at
/nix
by runningsudo vim /etc/synthetic.conf
and deleting the line
nix
. -
Reboot the system for changes to take effect.
-
Run
echo "removing daemon" sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist echo "removing daemon created users and groups" USERS=$(sudo dscl . list /Users | grep nixbld) for USER in $USERS; do sudo /usr/bin/dscl . -delete "/Users/$USER" sudo /usr/bin/dscl . -delete /Groups/staff GroupMembership $USER; done sudo /usr/bin/dscl . -delete "/Groups/nixbld" echo "reverting system shell configurations" sudo mv /etc/profile.backup-before-nix /etc/profile sudo mv /etc/bashrc.backup-before-nix /etc/bashrc sudo mv /etc/zshrc.backup-before-nix /etc/zshrc echo "removing nix files" sudo rm -rf /nix sudo rm -rf /etc/nix sudo rm -rf /etc/profile/nix.sh sudo rm -rf /var/root/.nix-profile sudo rm -rf /var/root/.nix-defexpr sudo rm -rf /var/root/.nix-channels sudo rm -rf /var/root/.cache/nix rm -rf ~/.nix-profile rm -rf ~/.nix-defexpr rm -rf ~/.nix-channels rm -rf ~/.nixpkgs rm -rf ~/.config/nixpkgs rm -rf ~/.cache/nix
to remove all remaining
Nix
artifacts from the system.
Two more updates on this: