Installing the Nix package manager on Mac OS X
fink a bit back in 2001, when OS X was shiny and new, but didn’t really use it much. After abandoning fink back then, I haven’t used any package manager for OS X at all. But OS X is not shiny and new; it’s shipped with ancient versions of Python forever, some of the official versions of Python for Mac have been buggy for me, and I’ve been using Linux more and wanting some of the advantages of package managers.
I use a lot of Debian, so maybe fink would be the way to go again; it seemed nearly dead for a long time. Here’s a great late-2013 overview of the state of package management on Mac OS X. But toying around with Linuxes and functional programming has pointed me to NixOs and the Nix package manager.
Going to nixos.org/nix/, we are advised to install by downloading an install script and piping it to
sh. Hm, piping it to
less instead doesn’t reveal anything too obviously scary: it downloads and installs a binary for x86_64-linux, i686-linux, or x86_64-darwin. So we’ll try
sudo curl https://nixos.org/nix/install | sh
nix-env can perform one of several operations per invocation.
* Installing software is done with the
--install or ‘
-i flag. See also the
-b flag to install pre-built/binary software only, and the
--dry-run flag which runs through the process without doing anything (for testing purposes).
* Upgrading software uses the
-u flag. Also the
-b flag works here.
* Uninstalling software can be done with the
* Querying with
-q by default shows the installed packages. See also the
-a flags and the
So for example
nix-env -qc should compare installed versions for what’s available. The command
nix-channel --update will update the list of Nix expressions.