Can't find nix-env or nix-build on MacOS Catalina

1.7k Views Asked by At

I can't find nix-env, nix-build, nix-shell etc. on MacOS Catalina.

I installed with:

sh <(curl https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume

and was able to run them yesterday. I restarted my computer and can no longer find them. find / -name nix-env | grep nix-env shows nothing.

I tried installing again with the same command (sh <(curl https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume) but this time it exists immediately with 0 status code.

I suspect I need to do something to mount a virtual drive.

3

There are 3 best solutions below

1
On BEST ANSWER

Use the Disk Utility UI to remove the nix volume (sudo rm -rf /nix won't work).

Then run the script again and cross fingers your fingers this time: sh <(curl https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume

4
On

While Nix (amongst others) installs with bash newer MacOS do use zsh instead of bash.

So you need to update your .zshrc to source this command from bash, too.

In your terminal start editing with:

sudo nano ~/.zshrc

and add:

source ~/.nix-profile/etc/profile.d/nix.sh

Reload and test with

source ~/.zshrc; nix --version
2
On

You should follow Notes on the recommended approach.

It looks like the volume is not mounted (check /etc/fstab state with vifs as described in documentation).