This guide covers how to uninstall Isabel’s Dotfiles configuration and, if desired, completely remove Nix from your system.
Uninstalling will remove all NixOS/nix-darwin system configurations and may delete important data. Make sure you have backups of any files you need before proceeding.
Uninstalling nix-darwin (macOS)
If you’re using nix-darwin on macOS, you can cleanly uninstall it using the official uninstaller.
Run the uninstaller
Execute the nix-darwin uninstaller from the official repository: nix run github:LnL7/nix-darwin#darwin-uninstaller
This command will:
Remove the nix-darwin system configuration
Restore your original system files
Clean up nix-darwin-specific changes
Follow the prompts
The uninstaller will ask for confirmation before making changes. Follow the interactive prompts to complete the uninstallation. The uninstaller will preserve your Nix store and packages. If you want to remove Nix entirely, continue to the next section.
Uninstalling NixOS
Uninstalling NixOS requires reinstalling a different operating system, as NixOS is a complete Linux distribution.
Backup your data
Before proceeding, back up any important files from your home directory and any other locations: # Example: backup to external drive
rsync -av /home/yourusername/ /mnt/backup/
Create installation media
Download and create installation media for your preferred operating system (Ubuntu, Fedora, etc.).
Boot from installation media
Restart your computer and boot from the installation media.
Install new OS
Follow your new operating system’s installation process. You can choose to:
Reformat the entire disk (removes all NixOS data)
Keep your home partition and only replace the system partition (preserves user files)
Removing Nix from other systems
If you installed Nix using the standalone installer on a non-NixOS system (Linux, macOS, WSL), follow these steps.
Multi-user installation (recommended)
For multi-user installations (the default on macOS and the recommended installation on Linux):
Remove Nix daemon service
On Linux with systemd: sudo systemctl stop nix-daemon.socket
sudo systemctl stop nix-daemon.service
sudo systemctl disable nix-daemon.socket
sudo systemctl disable nix-daemon.service
sudo systemctl daemon-reload
On macOS: sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo launchctl unload /Library/LaunchDaemons/org.nixos.darwin-store.plist
sudo rm /Library/LaunchDaemons/org.nixos.darwin-store.plist
Remove Nix store and files
This permanently deletes all Nix packages and data. Make sure you don’t need anything from /nix before running this command.
Remove Nix build users
On Linux: for i in $( seq 1 32 ); do
sudo userdel nixbld $i
done
sudo groupdel nixbld
On macOS: for i in $( seq 1 32 ); do
sudo dscl . -delete /Users/_nixbld $i
done
sudo dscl . -delete /Groups/nixbld
Clean up shell configuration
Remove Nix-related lines from your shell configuration files: # Edit these files and remove Nix-related content
nano ~/.bashrc
nano ~/.zshrc
nano ~/.profile
nano ~/.bash_profile
Look for and remove lines that reference /nix or source Nix scripts.
Remove backup files
The Nix installer creates backups of modified files: sudo rm -rf /etc/bashrc.backup-before-nix
sudo rm -rf /etc/zshrc.backup-before-nix
sudo rm -rf /etc/bash.bashrc.backup-before-nix
For single-user installations (less common):
Clean up shell configuration
Remove Nix-related lines from your shell configuration files: nano ~/.bashrc
nano ~/.zshrc
nano ~/.profile
Remove any lines that reference Nix or source Nix scripts.
Removing Isabel’s Dotfiles only
If you want to keep Nix but stop using Isabel’s Dotfiles configuration:
Switch to a different configuration
If you have another NixOS/nix-darwin configuration: # NixOS
sudo nixos-rebuild switch --flake /path/to/other/config
# macOS
darwin-rebuild switch --flake /path/to/other/config
Or create a minimal configuration
Create a basic flake.nix with minimal settings and switch to it: mkdir ~/minimal-config
cd ~/minimal-config
# Create a minimal flake.nix
sudo nixos-rebuild switch --flake .#
Remove the dotfiles repository
Once you’ve switched to a different configuration: rm -rf ~/path/to/dotfiles
Clean up old generations
Remove old system generations that used Isabel’s configuration: # List generations
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
# Delete old generations
sudo nix-env --delete-generations old --profile /nix/var/nix/profiles/system
# Garbage collect
sudo nix-collect-garbage -d
Verification
After uninstalling, verify that Nix has been completely removed:
Check for Nix directory
Check for Nix commands
Check for Nix in PATH
ls /nix
# Should return: No such file or directory
Troubleshooting
Permission denied when removing /nix
On some systems, especially macOS with Apple Silicon, /nix may be on a separate volume: # Check if /nix is a mount point
mount | grep /nix
# If it's mounted, unmount first
sudo umount /nix
# Then remove
sudo rm -rf /nix
# On macOS, you may also need to remove the synthetic.conf entry
sudo nano /etc/synthetic.conf
# Remove the line containing "nix"
If the Nix daemon service won’t stop: # Force kill the daemon
sudo pkill nix-daemon
# Then proceed with uninstallation
Files still reference Nix after removal
Search for and update any remaining references: # Find files that reference Nix
grep -r "/nix" ~/.config/ ~/.local/ 2> /dev/null
# Manually edit or remove these files
Getting help
If you encounter issues during uninstallation:
Remember that uninstalling is permanent. If you’re unsure, consider keeping your configuration in a backup location before removing everything.