/nix/bin not existing

The Nix manual says:

To use Nix, some environment variables should be set. In particular, PATH should contain the directories prefix/bin and ~/.nix-profile/bin. The first directory contains the Nix tools themselves, while ~/.nix-profile is a symbolic link to the current user environment

I’m assuming “prefix” means /nix. I installed Nix and it works but my $PATH doesn’t include /nix/bin. And /nix/bin doesn’t even exist. Is this an error in the manual or am I not understanding it?

prefix is Autotools terminology¹. It refers to the path Nix was installed to. It will be something like /nix/store/frsdhkhqd7fpzbmnzd9zmvq9klw20svm-nix-2.2.2. Though, we usually do not add prefix/bin to $PATH directly – instead, when we install Nix, it is symlinked to a profile (for example, under /run/current-system/sw/bin or ~/.nix-profile/bin) and that is added to $PATH.

1 Like

If the nix executable is not found, try restarting the shell and check that ~/.nix-profile/bin is added to the PATH afterwards.

What I would do is make then change and then look at the new path. Assuming you’re using bash:

bash -lc "echo \$PATH"

This should act like a new login shell would, without losing your current shell (in case there are troubles).

It would probably be better to do something like env -u PATH bash -lc 'echo $PATH' to ensure the bash subshell builds a new path from scratch.