I recently had to uninstall and reinstall Nix on my m1 mac. It took me quite some time, but this is everything I needed to get it removed and reinstalled.
Delete Nix Store from disk utility
Remove /nix entry from /etc/fstab (possibly optional) with sudo nano /etc/fstab
sudo rm -rf /etc/synthetic.conf
sudo dscl . -list /Users | grep nix | xargs -I % sudo dscl . -delete /Users/%
sudo dscl . -delete /Groups/nixbld
sudo mv /etc/bashrc.backup-before-nix /etc/bashrc
sudo mv /etc/bash.bashrc.backup-before-nix /etc/bash.bashrc
sudo mv /etc/zshrc.backup-before-nix /etc/zshrc
Reboot computer
sudo rm -rf /etc/nix /nix /var/root/.nix-profile /var/root/.nix-defexpr /var/root/.nix-channels /Users/alishataylor/.nix-profile /Users/alishataylor/.nix-defexpr /Users/alishataylor/.nix-channels
sudo launchctl enable system/org.nixos.nix-daemon
sh <(curl -L https://nixos.org/nix/install) --daemon --darwin-use-unencrypted-nix-store-volume
Restart terminal
These are some the threads I worked through as I hit each error:
- Unable to install Nix 2.4 and 2.5.1 on Mac OS Monterey · Issue #5498 · NixOS/nix · GitHub
- Installing nix on macOS BigSur · GitHub
- Multi-user installation fails on macOS Mojave · Issue #4020 · NixOS/nix · GitHub
- I can't install Nix on macOS Catalina with multi-user · Issue #4106 · NixOS/nix · GitHub
- Multi-user Darwin installer fails to load org.nixos.nix-daemon · Issue #2780 · NixOS/nix · GitHub
To add some background, I had Nix multi-user on my machine, but a tutorial had me install the single user version as a requirement to continue. I then realized that I need the multi-user for work, so needed to add it back but hit a ton of issues, including some of the errors below:
error: the build users group 'nixbld' has no members
Could not find service "org.nixos.nix-daemon" in domain for system
org.nixos.nix-daemon.plist: Service is disabled
Hope this helps someone one day, maybe even future me!
EDIT - Check out the installation manual that toonn linked below, which solves every single issue here!