Thoughts on macOS Package Managers

I have a Mid-2012 Retina Macbook-Pro – great machine, but Brew recently quit supporting it. It still tries to install stuff from source, but the process seems very slow and fragile. As an example, I tried to upgrade neovim:

Hmm …

My old MacBook still works fine for what I need it for (a portable computer terminal) – the screen and keyboard are great, but a computer without a decent package manager is rather useless, so I have been researching other options including Nix and MacPorts. I’m pretty spoiled by Arch Linux pacman – it is blazing fast, just works, and is near perfection from what I could want from a package manager. pacman is the reason I would not buy another Mac, even though their hardware is great. Brew is written in Ruby, and is fairly slow. MacPorts is written in C and TCL:

image

It appears MacPorts installs from source, so not thrilled about that, but probably the only practical option for supporting all the different versions of MacOS out there, and it supports the MacOS version I’m stuck on.

I installed nvim with MacPorts and it went surprisingly fast. I got nvim 0.8.1 which is a few months old, whereas Arch and Brew have the latest 0.8.3.

It does not appear that MacPorts has Thunderbird or Brave ports :frowning: – maybe it is more focused on command-line tools.

Probably should just get a new machine, but I hate throwing perfectly good equipment away when the only reason is software … this does not seem responsible and sustainable for society as a whole. Perhaps another option is to install Linux on the Mac – looks like Arch supports it ….

The below article is an interesting comparison of Brew and Macports.

The two package managers differ in how they distribute packages: MacPorts almost always builds packages from source, while Homebrew has continuously gotten less and less permissive of letting you do this (opting instead for downloading pre-built binaries). From a usability perspective, binaries are a clear winner: packages install much quicker and are usable nearly immediately, and you don’t leave your computer barely usable because it’s been compiling the newest version of LLVM for the last four hours. Overall, however, this is less of a problem than it may seem at first, since most package are small and build relatively quickly, making long port upgrade outdated invocations quite rare.

My pipe dream is - universal binaries and package manager which works across platforms. Apps are what defines the computing world today, so perhaps all different unix variants and even windows can come together in a room and agree upon single solution then apps can work across platforms for long long time and you would have pushed some of packaging work to app itself.

1 Like

That would be amazing – architectures are fairly standard now – x86_64, arm64, riscv64 …

Maybe some progress in this direction – at least for Linux:

Yeah a step in right direction and perhaps distros can still remain with rpm/dpkg/ipk or whatever they use for a small subset of platform which hardly change.

My first attempt at installing and using Nix on MacOS with the standard install process failed. I don’t recall the error message, but have little patience for complex software that can’t even install reliably. Then I tried an alternative installer:

This seems to work.

The following all failed:

nix run "nixpkgs#firefox"
nix run "nixpkgs#thunderbird"
nix run "nixpkgs#brave"

with messages like:

<package> is not supported on ‘x86_64-darwin’, refusing to evaluate.

Packges like python3 and iterm2 run right off, so are likely cached.

gimp ran after building for 10 minutes.

inkscape ran pretty quickly.

Overall, probably workable. The few heavy graphical packages I need like Thunderbird and a browser could probably be installed manually and many of these now update themselves.

Will continue down this path for a bit and see where it leads …

For firefox/thunderbird you can use the release directly on mac I think and that would follow its own update cadence but it works pretty well.

1 Like

Installing/uninstalling packages via nix seems to be working OK:

nix-env -iA nixpkgs.iterm2
nix-env --uninstall iterm2

However, it does not show up in Applications.

And the options to make this happen don’t look all that appealing:

There is something wrong when layers and layers of complexity are required to do simple things …

So at this point, I’m moving forward with:

  • use brew to install some things – it still seems to work fine for applications like Workflowy, Signal, Zoom, etc – packages that download binaries.
  • manually install some larger applications (Libreoffice, Brave, Thunderbird)
  • use Nix to install command-line tools (neovim, etc)

A few more notes:

  • commands like nix-channel need to be run as root
  • nixpkgs-unstable is the default channel
  • nix-env -iA nixpkgs.<package> can be used to upgrade (as well as install) after update

But how to update all packages after nix-channel --update? Some of the simplest things are so hard in nix … I am just thoroughly spoiled by Arch Linux and pacman

After searching for a bit, I ended up trying OpenAI chat:

The first command failed:

cbrake@macbook ~ % nix-env -iA nixpkgs.unstable.all
error: attribute 'unstable' in selection path 'nixpkgs.unstable.all' not found
       Did you mean notable?

The second one completed, but did not do anything – perhaps everything is up to date.

The current task is to get syncthing installed again – it installs fine with Nix, but does start automatically, and does not give much help in setting up services to do that. Brew takes a while to install as it has to build Go first, but then seems to set things up correctly in services.

So far, running brew and nix in parallel seems like a workable solution, and gives me some experience with nix.

Apple hardware is really nice, but I’ve resisted buying a new MacBook as I prefer the Arch/KDE experience, but none of the PC based notebook options look very interesting at the moment.