Solvednix How to remove nix

Hi,

I am using nix on Ubuntu 16. I installed nix by these commands:

bash <(curl https://nixos.org/nix/install)
source ~/.nix-profile/etc/profile.d/nix.sh

I have not started nix-daemon. Or I did not use any extra command...

I will not remove the nix package manager now. But If I should remove it, what should I type on command line? Is there any ready script or something?

I found this topic: #458 But it is not completely clear about uninstallation. Because there is not only /nix folder. There are link files on HOME + nix has set some directories to PATH variable?

How can I make sure that I remove it completely?

Thank you

24 Answers

✔️Accepted Answer

To uninstall nix you will need to do the following things:

  • remove the . "$HOME/.nix-profile/etc/profile.d/nix.sh" line in your ~/.profile or ~/.bash_profile
  • rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs}
  • sudo rm -rf /nix
    On a multi-user install, also remove all the nixbld[0-9] users

Other Answers:

no offical uninstaller?

Or for macOS:

for num in {1..32}; do sudo dscl . -delete /Users/nixbld$num; done
sudo dscl . -delete /Groups/nixbld

I find a new way, install again and installer will tell you how to remove it, all included but deleting user.

Just to update this for people using Mac OS X

You still have to erase then remove your nix partition under Disk Utilities

Running $ sudo rm -rf ~/nix may yield a Resource is Busy message

$ ls -alh /nix
will show that there are some mac os x specific files like:

.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

edit: these files are why nix persists on the filesystem after trying to remove it using instructions above

Bring up Disk Utilities then go and remove

After deleting you can rm -rf ~/nix
running $ lsof +D /nix will show nothing, meaning it has been removed

don't forget to empty your trashbin

More Issues: