The evolution of macOS package management
Homebrew maintains dominance in macOS package management through its simplicity and automated bottle building, despite competition from MacPorts and the functional approach of Nix. While Homebrew integrates Linuxbrew for non-sudo installations, Nix offers high speed using a C++ backend.
Homebrew and the legacy of MacPorts
Max Howell created Homebrew to focus on user experience. He prioritized simplicity over complex computer science problems. Homebrew uses Ruby as a backend, which makes it slower than MacPorts. MacPorts uses C and a Tcl backend. MacPorts uses the traditional /usr/local prefix for installations. Homebrew uses its own install prefix. While MacPorts developers eventually added binary archives in 2011 to improve the user experience, many users had already switched to Homebrew because of its simpler installation process and better momentum. Homebrew also includes Cask for managing GUI applications.
The Homebrew project grew through a 2013 Kickstarter campaign. This funding allowed the team to purchase multiple Mac minis. These machines automate the process of building and testing "bottles," which are prebuilt binary packages. The team uses VMware Fusion to build these bottles for various macOS versions. They moved their hosting from SourceForge to Bintray to avoid downtime. MacStadium later provided ESXi hosts to allow the project to double its workers for each macOS version.
MacPorts remains a major competitor because of its deep legacy support. It provided ARM support within a week of the M1 release because its infrastructure already supported PowerPC. However, Homebrew won the race for many new developers on OS X. Homebrew remains the top choice for many Mac users because it works. Users can install software without complicated build processes, but the software breaks when macOS undergoes major updates. Homebrew breaks when macOS undergoes major updates because its maintainers make opinionated decisions for the majority of users. You likely understand the frustration of resolving complex dependency conflicts.
Linux integration and the Linuxbrew merger
Homebrew now supports Linux through the integration of Linuxbrew. Linuxbrew was a separate project that merged into the main Homebrew repository in 2019. It allows users to install software into their user HOME directory. This capability removes the need for sudo privileges. Linuxbrew installs to /home/linuxbrew/.linuxbrew by default. Some users choose to install to $HOME/.linuxbrew to avoid permission issues. This alternative choice can cause errors if packages have hardcoded paths. If a package has hardcoded paths, Homebrew automatically uses the -s or –build-from-source option when installing to the home directory.
Linuxbrew provides access to newer package versions than standard Linux repositories. It keeps a Linux environment clean. Users must install specific dependencies before they start. For Ubuntu and Debian, users install build-essential, curl, file, and git using the Apt package manager. For Fedora and other RPM-based systems, users install the development tools package group, curl, file, and git. For OpenSUSE, users install all available development packages along with curl, file, and git. Linuxbrew is useful for users who cannot use sudo to install packages in /usr/bin. Linuxbrew is a tool for users who want to install software like Yarn without the complexity of manual installation, which helps them maintain a clean system by avoiding messy dependency issues.
The functional approach of Nix
Nix offers a functional programming approach to package management. It is the package manager for the NixOS Linux distribution. Nix is written in C++, which makes it as fast as MacPorts. On macOS, Nix creates a separate APFS volume that mounts under /nix. This volume hosts all packages and accommodates the read-only root filesystem of modern macOS. The automated installation script manages the volume creation and the shell configuration. Nix remains a good choice for macOS users because it is a Linux package manager.
Nix transforms existing Linux distributions into hybrid systems. A user can use apt, dnf, or pacman alongside Nix on a single machine. This power is less effective on the macOS port of Nix. Nix provides access to almost everything available on NixOS. While Nix is powerful, it requires a functional deployment approach that some users find unappealing. Will the speed of Nix eventually cause more users to leave Homebrew behind?