Nix and MacOS Sequoia

How to restore a Nix environment on MacOS 15 Sequoia.
In the blog post Getting started with Nix Package Manager we covered how to install Nix. A quick follow up on that post to discuss how to update a Mac post a system upgrade.
The upgrade will likely wipe out your Nix settings, so a reinstall is a quick way to get up and running. I dont persist installations using Nix, so I can always can wipe my installation. If you persist software using Nix, you will want to add an additional step to remove software prior to the system update.
Nix Reinstallation
Ok, so the Mac system upgrade has completed successfully. However the nix installation is no longer working. Time to wipe those pesky configuration files.
Nix includes some backups when updating your system. If you just use nix-shell for temporary package installation, you can simply wipe the prior config. On a Mac, this means removing the zsh backup (or if you are like me, the bash backup).
File | Location |
---|---|
bashrc.backup-before-nix | /etc/bashrc.backup-before-nix |
zshrc.backup-before-nix | /etc/zshrc.backup-before-nix |
bash.bashrc.backup-before-nix | /etc/bash.bashrc.backup-before-nix |
- Remove the backup files
1sudo rm /etc/bashrc.backup-before-nix
2sudo rm /etc/zshrc.backup-before-nix
3sudo rm /etc/bash.bashrc.backup-before-nix
- Reinstall the nix
1sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install)
- Exit the terminal and restart to enjoy nix once more