When comparing Nix package manager vs Homebrew, the Slant community recommends Homebrew for most people. In the question“What are the best Mac package managers?” Homebrew is ranked 1st while Nix package manager is ranked 3rd. The most important reason people chose Homebrew is:
Homebrew makes it easy for people to quickly install any open source software (that is contained within the apps repositories) for Mac.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro It's easy to revert any change in your environment
Every time your profile changes, you get a new generation of your profile and older generations are kept around, so you can easily (and atomically) revert to older version of your profile.
Pro Packages installed with Nix don't overlap with packages installed in /usr/local
Since packages are stored in the /nix directory, it won't overlap with anything you'd install in /usr/local or wherever else.
Pro Can keep around several profiles for you to use
You can have different (probably overlapping) sets of software installed in two or more profiles that will be handled (changed, versioned, upgraded, reverted) independently. All software will be installed in the same /nix/store, so any overlaps between your sets will be physically installed only once.
Pro You always and atomically get an isolated consistent profile
Every time you install, delete or change anything you get a new fresh copy of your user environment (set of symlinks to files in /nix/store) that's stored in the same /nix/store and handled mostly the same way. Your "profile" (symlink to one of environments) is updated after everything else is ready, so you'll never end up in a half-finished state of your system.
Pro Does not require root priviledges
Everything is owned by your user (unless you use more powerful multiuser mode that doesn't require root either).
Pro Uses binary caches (that are provided) so you don't have to build anything locally
Due to its functional nature, it can just download a binary package with the same hash if its available and it'll get the very same package as you'd build locally (to the last bit that is).
Pro Packages don't change after they are built
Nix treats packages like values in a functional language. Since they are built by functions without side effects they never change after they are built.
Pro Very easy to share compiled binaries between machines
You can share packages via HTTP or SSH (push or pull) with just some simple commands.
Pro Easy to install
Requires just one shell script to install, only one directory is created via sudo. This makes for a pretty simple install method that most can grasp.
Pro Many apps
Since it is compatible on Mac and Linux, there are many apps in their repos.
Pro Quick access to a large repository of open source software
Homebrew makes it easy for people to quickly install any open source software (that is contained within the apps repositories) for Mac.
Pro Easy to setup and use
Once installed, you control Homebrew using the brew command. You can find packages using brew search, install them using brew install and remove them using brew uninstall.
Pro Open Source
Pro Less maintenance than Macports
Macports seems to be able to get into a bad state where new packages are unable to be installed, or installed software was unable to be updated. This simply hasn't happened with Homebrew. In addition to not having to deal with corruption problems, Homebrew installs packages in userland. Not requiring root to install software is a big win.
Pro Builds quickly and requires few dependencies
Homebrew as much as possible uses already existing libraries and tools to install software thus making builds quick and requiring few dependencies.
Pro Unintrusive
Homebrew installs packages to their own directory and then symlinks their files into /usr/local
. Homebrew won’t install files outside its prefix, and you can place a Homebrew installation wherever you like.
Pro Does not require using sudo
One of the things to like about Homebrew is that it refuses to run things under sudo
most of the time. This is a great policy, but it causes issues when you want to create symlinks or install in places that SIP has changed permissions on.
Pro Homebrew tries very hard to use existing tools and libraries
Homebrew’s recipes try very hard to use the existing tools and libraries in OS/X, so they tend to build much faster and require fewer dependent libraries.
Cons
Con Steep learning curve
There are lots of unfamiliar concepts and jargon (e.g. fixpoint, instantiate, realise).
Con Cannot handle filetypes that have different semantics across different versions
While the functional approach that Nix takes is great for sandboxing binary artifacts of packages, it seriously lacks any power in handling configuration files or user data. It's difficult to upgrade and downgrade files where semantics and syntax can change between versions. Especially in Debian/Ubuntu it can cause severe problems where the upgrade process blocks and the user needs to resolve the 3-way merge.
Con May cause issues when trying to create symlinks or installing in places where SIP has changed permissions
One of the things to like about Homebrew is that it refuses to run things under sudo
most of the time. This is a great policy, but it causes issues when you want to create symlinks or install in places that SIP has changed permissions on. (Alternatively, you could install Homebrew somewhere other than /usr/local
, but that might break various packages that depend on having stuff in and relative to /usr/local/
.)
Con Command line tools for XCode required
Once xcode is installed you can install Homebrew, including new(er)/different versions of most of the build stuff that xcode-select installed, like a newer gcc, newer git, etc.