Installing a Binary Distribution
If you are using Linux or Mac OS X, the easiest way to install
Nix is to run the following command:
$ bash <(curl https://nixos.org/nix/install)
This will perform a single-user installation of Nix, meaning that
/nix is owned by the invoking user. You should
run this under your usual user account, not as
root. The script will invoke sudo to create
/nix if it doesn’t already exist. If you don’t
have sudo, you should manually create
/nix first as root, e.g.:
$ mkdir /nix
$ chown alice /nix
The install script will modify the first writable file from amongst
.bash_profile, .bash_login
and .profile to source
~/.nix-profile/etc/profile.d/nix.sh. You can set
the NIX_INSTALLER_NO_MODIFY_PROFILE environment
variable before executing the install script to disable this
behaviour.
You can also download a binary tarball that contains Nix and all
its dependencies. (This is what the install script at
https://nixos.org/nix/install does automatically.) You
should unpack it somewhere (e.g. in /tmp), and
then run the script named install inside the binary
tarball:
alice$ cd /tmp
alice$ tar xfj nix-1.8-x86_64-darwin.tar.bz2
alice$ cd nix-1.8-x86_64-darwin
alice$ ./install
Nix can be uninstalled using rpm -e nix or
dpkg -r nix on RPM- and Dpkg-based systems,
respectively. After this you should manually remove the Nix store and
other auxiliary data, if desired:
$ rm -rf /nix
You can uninstall Nix simply by running:
$ rm -rf /nix