What’s Going On?

Yesterday, I happily upgraded my macOS to 15, but today when I tried to build my site with hugo, I found that hugo was missing?!

1
2
(base) BdimMacBook-Pro:~ bdim404$ hugo
-bash: hugo: command not found

I thought to myself, I didn’t uninstall hugo!

I installed hugo using nixpkgs, so I checked if nix was still there.

1
2
(base) BdimMacBook-Pro:~ bdim404$ nix
-bash: nix: command not found

Oh no, nix is gone?!

What Happened?

I asked a friend, and it turns out that every time macOS upgrades, the $PATH for nix disappears. This issue mentions it.

I did this a few days before upgrading to Catalina 10.15.6… and today I wanted to install something only to discover that my nix installation was gone!

Just like that, it vanished!

How to Fix It?

But I don’t want to reinstall nix.

To fix this, add the following lines to your /etc/bashrc or /etc/zshrc.

1
2
3
4
5
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
  source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix

And that’s it.

https://github.com/NixOS/nix/issues/3616