I just updated my macOS system version from 12.0 to 12.1 (21C52), and it seems like nix and home-manager have been mysteriously “uninstalled”:
❯ which nix-shell
nix-shell not found
Thankfully my nix store has been preserved however:
❯ ls /nix/store | head -n 5
How do I “re-enable” nix now?
Maybe the upgrade reset your
/etc/zshrc. Is Nix mentioned anywhere there?
If not, look for the relevant profile script, I think in in
/nix/var/nix/profiles/default/etc/profile.d. I think it may be called
nix-daemon.sh. Normally on macOS,
/etc/zshrc check if that file exists in an
if block, then source it if it does.
The other thing you might have to set back up if it got nuked is the launchd entry that automatically starts the Nix daemon
Is there a convenient way to just get back up to speed? Eg could I just run the installer again to safely get things back to normal?
/etc/zshrc btw: zshrc · GitHub. No nix anything in there AFAICT.
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
# End Nix
to the end of my
/etc/zshrc and that seemed to do the trick! Thanks @abathur!
Just had this happen again with the upgrade to macOS 12.2.1.
And it will happen with the next update well, as Apple doesn’t respect your wishes.
Perhaps they leave your user configuration intact? Can’t you source the nix profile script from there?
This happens when I upgrade to macOS 12.6.1
Your solution solved it.