14

I've installed Nix into an Ubuntu WSL installation. I now want to uninstall it.

The manual states to simply "rm -rf /nix".

Nix adds itself to $PATH and the manual makes mention of a Nix daemon.

Surely there are other parts of my system that Nix has added itself to.

For one, I can see an entry in ~/.profile which is sourcing ~/.nix-profile/etc/profile.d/nix.sh

Is there anything else that needs to be done?

Rebs
  • 4,169
  • 2
  • 30
  • 34
  • Just in case: [This NixOS discourse thread](https://discourse.nixos.org/t/anyone-up-for-picking-at-some-nix-onboarding-improvements/13152/6) has tons of links to GitHub issues requesting documentation and `nix` features for smoother uninstall/re-install experience. – toraritte Jul 01 '21 at 12:28

2 Answers2

13

NOTE: This answer is about uninstalling Nix from a Linux or Linux-like system in 2018. Since then, Nix has started to support systemd unit installations and since Catalina, macOS installations have become more complex too. This answer is not official documentation.

The "curl | sh" installer for Nix on Linux does not install the Nix daemon, so the only things to delete are /nix, the line in ~/.profile and ~/.nix-profile.

Robert Hensing
  • 6,708
  • 18
  • 23
  • 1
    [This answer on GitHub](https://github.com/NixOS/nix/issues/1402#issuecomment-312496360) also mentions the removal of dot-folders in `$HOME`: `rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs}` – ilyazub May 07 '21 at 10:13
  • the installation does a lot of things, like create a volume, update /etc/bashrc, create a launch daemon. how to undo all this? – Ben Keil Jan 20 '22 at 04:43
  • It seems that you're asking about macOS, whereas this answer was about WSL, which runs a Linux user space. The macOS installation has indeed become more complex after this answer was written, particularlly since Catalina. – Robert Hensing Jan 20 '22 at 08:33
4

This is an answer for readers who are on macOS M1 after 2023/3.

  1. Make sure that you installed Nix by the shell script of Multi-user installation, from the official site.
  2. Do NOT remove your /nix directly(as many old answers said)! If you have removed it then this answer CANNOT help you!
  3. Follow all steps exactly from https://nixos.org/manual/nix/stable/installation/installing-binary.html?highlight=uninstall#macos.
NeoZoom.lua
  • 2,269
  • 4
  • 30
  • 64