Upgrading Nix on macOS.
Table of Contents
Pre-Requisites
Upgrading Nix on macOS can be done through a few steps. The process might vary slightly depending on how Nix was originally installed (e.g., single user or multi-user installation). Here’s a general guide to upgrade Nix on macOS:
- Open the Terminal: You can find the Terminal application in your Applications folder under Utilities, or you can search for it using Spotlight.
- Check the Current Version: Before upgrading, it's a good idea to check the version of Nix you currently have installed. You can do this by running:
nix-shell -p nix-info --run "nix-info -m"
Multi-User Upgrade
sudo nix-env --install --file '<nixpkgs>' --attr nix -I nixpkgs=channel:nixpkgs-unstable
sudo launchctl remove org.nixos.nix-daemon
sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist
Single User Upgrade
nix-env --install --file '<nixpkgs>' --attr nix cacert -I nixpkgs=channel:nixpkgs-unstable