MacOS – How to completely remove Nix package manager
installmacosopen sourcesoftware
I installed Nix package manager, and now I would like to remove it completely.
How can I do it?
Best Answer
I asked myself the same question and searched the file system for Nix-related files. That's what I found:
# as user, remove:
rm -r ~/.nix-channels ~/.nix-defexpr ~/.nix-profile
# as root (sudo), remove:
sudo rm -r /nix
# edit the file ~/.profile and remove the line containing "added by Nix installer"
Not sure if I missed some files or directories. Also, I did not remove it myself, so be careful (and backup your data!) when removing stuff with sudo.
If you installed to /usr/local then you can use the script in this gist to uninstall — it will only remove Homebrew and the stuff Homebrew installed leaving anything else in /usr/local alone.
Provided you haven’t put anything else in Homebrew’s prefix (brew --prefix), you can generally just rm -rf that directory. This is because Homebrew won’t touch files outside its prefix.
Best Answer
I asked myself the same question and searched the file system for Nix-related files. That's what I found:
Not sure if I missed some files or directories. Also, I did not remove it myself, so be careful (and backup your data!) when removing stuff with sudo.