The impending release of macOS 15 Sequoia will break many existing nix installs on macOS, which may lead to an increased number of people who are looking to try to reinstall Nix without noticing the open/pinned issue (NixOS#10892) that explains the problem and outlines how to migrate existing installs. These admonitions are a short-term measure until we are over the hump and support volumes dwindle.
2.2 KiB
(install-nix)=
Install Nix
:::::{tab-set}
::::{tab-item} Linux
Install Nix via the recommended multi-user installation:
$ curl -L https://nixos.org/nix/install | sh -s -- --daemon
On Arch Linux, you can alternatively install Nix through pacman
.
::::
::::{tab-item} macOS
Install Nix via the recommended multi-user installation:
$ curl -L https://nixos.org/nix/install | sh
:::{important} Updating to macOS 15 Sequoia
If you recently updated to macOS 15 Sequoia and are getting
error: the user '_nixbld1' in the group 'nixbld' does not exist
when running Nix commands, refer to GitHub issue NixOS/nix#10892 for instructions to fix your installation without reinstalling. :::
::::
::::{tab-item} Windows (WSL2)
Install Nix via the recommended single-user installation:
$ curl -L https://nixos.org/nix/install | sh -s -- --no-daemon
However, if you have systemd support enabled, install Nix via the recommended multi-user installation:
$ curl -L https://nixos.org/nix/install | sh -s -- --daemon
::::
::::{tab-item} Docker
Start a Docker shell with Nix:
$ docker run -it nixos/nix
Or start a Docker shell with Nix exposing a workdir
directory:
$ mkdir workdir
$ docker run -it -v $(pwd)/workdir:/workdir nixos/nix
The workdir
example from above can be also used to start hacking on Nixpkgs:
$ git clone git@github.com:NixOS/nixpkgs
$ docker run -it -v $(pwd)/nixpkgs:/nixpkgs nixos/nix
bash-5.1# nix-build -I nixpkgs=/nixpkgs -A hello
bash-5.1# find ./result # this symlink points to the build package
::::
:::::
Verify installation
Check the installation by opening a new terminal and typing:
$ nix --version
nix (Nix) 2.11.0