As an old hand who was around when homebrew started, I feel obliged to let people know there are alternatives. If you find brew's take-over-your-system-and-youll-thank-me approach off putting, and/or you value stability over the coolness factor, MacPorts is still alive and well (https://www.macports.org), and in-fact has basically all the same packages brew does.
In 18 years of using MacPorts, it's never messed up my system, broken something that used to work or decided that I don't get to run commands right now, because it wants to run an upgrade. (It's also never spied on me.)
The price you pay for that is that more things are compiled from scratch, but hey - you only have to do that once, and it only takes like 20 minutes on a modern Mac. Upgrades are generally pretty fast.
FWIW, Homebrew uses /opt/homebrew instead of /usr/local on Apple Silicon installations, as far as I know that was the main sticking point for the complaint that it took over your system. Still isn’t terribly useful for multi-user systems as far as I know, but for my personal laptop this will never be a problem that I have to deal with.
I used pkgsrc on macOS for a while but ended up going back to Homebrew because it was easier and there were more packages relevant to my needs; I also found packages in pkgsrc wouldn’t play nicely with zsh or bash completion sometimes, I believe this was related to patches specifically required for macOS for these packages. The concept of casks is also very nice, as it means I can manage most packages using a single package manager instead of doing dmg->drag-n-drop installations or mucking around with install/uninstall scripts. Building and maintaining a dumb cask formula is also pretty easy for apps where there isn’t already an available cask.
I haven’t used Macports so couldn’t compare - can Macports install .app applications?
I've been trying Nix devenv[0] and nix-darwin[1] on Mac recently and having a blast. Definitely better than the stuff I had to build around Homebrew to make development environments consistent across machines. Nix-darwin even has support to install Homebrew packages.
For anyone curious, I have a unified setup that works across my work M1 (currently bitrotting), work Ubuntu (hurrah Intune for Ubuntu!), and personal NixOS[1]. You'll probably find my mkChoose function particularly interesting[2], which makes parameterizing attrsets and lists a little easier for different hosts (I currently don't have/know a way to discriminate between Linux and NixOS, so you need to pass a function which does that[3]).
If you aren't using home-manager[4] yet, I strongly recommend taking a look at it.
nix-darwin significantly elevates the competency of MacOS.
Yes, it is really great! I haven't had to run homebrew in forever; Nix + home-manager does it as part of my overall config. I've configured home-manager to both install and update homebrew packages.
Did you know you can even install Mac App Store apps?
I was bummed out by that too initially.But it's kind of inevitable with root not writable on the latest macOS releases and needing the store to be under /nix.
I used to be a staunch macports evangelist but ended up switching to homebrew. I've found it to be much simpler.
And, as a counter to your experience of not having it mess up a machine, every time you upgrade macOS to the next major version you have to jump through some hoops to get it to play ball again. Painful.
At some point I gave up on the hoops and installed homebrew instead and haven't looked back.
Ah, yes I did mean `/opt/homebrew` - and yes I know on Intel Macs it works differently, but it can be installed at custom locations for people who still have them.
> MacPorts is still alive and well (https://www.macports.org), and in-fact has basically all the same packages brew does.
I used macOS for a few years to try it out, and I found that Macports lacked many things I needed. Taking a quick look again, let's see...
* Oclgrind: No.
* Futhark: No.
* GHC: Yes! And updated to boot. (But I'd expect such major programs to be in any package system.)
* MLkit: No.
* hledger: Yes, although not the newest version.
* git-annex: Yes, but a rather old version.
* ispc: Yes, but again a rather old version.
The impression I got (which may be inaccurate) is that Macports has a long tail of older packages, but it does not have a lot of newer stuff. It is very easy and convenient to add packages to Homebrew (just a PR with a package definition in a Ruby DSL; most things are obvious), which I think is the main reason it has become successful.
Nowadays I suggest everyone just use Nix, of course. It's not as slick and has a tough barrier to entry, but it's built on fundamentally better principles than legacy package managers.
MacPorts had more packages I wanted and fewer outdated packages the last time I compared them. Homebrew won the time before.
Is the Homebrew Ruby DSL much easier than the MacPorts Tcl DSL? I think the main reason Homebrew succeeded was it had binary packages before MacPorts. But a more familiar language helped probably.
I recently switched back to MacPorts after 8 years on Brew. However, a few weeks ago the outdated GDAL port broke, and I lack the expertise to quickly make a new port and haven’t had the time to figure out how to (I have contributed an updated version of Catch2, but that was very easy). So I’ve had to switch back to Brew. I hope this is only temporary.
The thing that pushed me over the Homebrew back when it was new was how with MacPorts, surprisingly often packages (at least those I was installing) were broken and required manual patching to make work.
While this would be a nuisance for me even today, I was only just starting to dip my toe into programming at that point which meant I lacked the technical knowledge to perform any changes more complicated than pasting in a single line somewhere, which meant it was often game over when a package was broken.
While Homebrew has its problems it’s easy to see how it became popular.
If you're looking for an alternative for creating dev environments, you should check out Devbox [https://jetpack.io/devbox]. Our goal is to combine the usability of tools like Brew or Yarn with the reproducibility and reliability of Nix.
MacPorts makes no effort to not look abandoned. It's very much 'the old way' of doing things from the look of the website to the terseness of the syntax. Before you take offense, I say this as a member of that generation.
These days if you have an ugly website, and opaque syntax, you're considered to be an abandoned project. Agree with it or not, your website sends a signal to the user and MacPort's signal says "it'll work till it doesn't and that's fine"
What are the odds that an Apple user finds that site attractive? I come from the linux world, so fine by me, but I'm no dummy, this site looks like it's going to tell me it runs better in a modern browser like IE6.
Completely agree, I'm a brew user myself but find the site of MacPorts rather clean and modern. It's responsive and doesn't feel abandoned at all (particularly https://ports.macports.org which support Dark mode). Plus, using brew, I never go to the website so I don't think this is really important.
In 18 years of using MacPorts, it's never messed up my system, broken something that used to work or decided that I don't get to run commands right now, because it wants to run an upgrade. (It's also never spied on me.)
The price you pay for that is that more things are compiled from scratch, but hey - you only have to do that once, and it only takes like 20 minutes on a modern Mac. Upgrades are generally pretty fast.