Fwiw you can use the Nix package manager (https://nixos.org/) on OS X to accomplish those same things. Lots of discussion about that the past few years:
I use Homebrew, and am genuinely appreciative of the amount of effort all the contributors have put in. However, as far as package managers go, it's kind of awful.
Homebrew excels as a mechanism to install the latest software, if you don't care about breaking things. However, traditionally a package manager's job is to ensure that if you've installed something, it'll continue to run.
If you've ever updated readline via Homebrew, you can pretty much just watch everything burn.
If you've ever tried to use an old version of Postgres, good luck. Particularly if you're wanting to mix and match versions of PostGIS.
If you're running an old version of macOS, you're out in the cold. Although, I must admit, recently this seems to be handled much better.
I understand why they did it, but it’s super annoying.
Given the intervals between running Homebrew, you just know it’s going to spin for a minute or two updating every damn time you try to use it, usually when you want something installed fast.
If you like treating your Mac like a very MacMacMac pet, a pm designed for Mac is probably better.
If you'd like to treat your Mac like UnixMac livestock, you probably want a cross-platform pm.
Using Nix means the core of my dev needs are met by config shared between my NixOS and macOS systems, with some idiomatic unshareable bits around the edges.
(I don't want to trivialize the gaps or over-sell Nix here. Nix forms a foundation for accomplishing this, but I do still have non-trivial bootstrap scripts for macOS.)
Unfortunately, Nixpkg doesn't check buildability on Darwin when merging PRs, so things can break quite often on the nixpkgs-unstable channel (compared to nixpkgs-unstable on Linux). It's not hard to rollback, though, but it does makes me never want to ever run `nix-channel --update`.
I feel similarly and am a little careful about when I choose to take an update.
That said, I think most people want darwin failures to be able to block, so it's mostly about getting on top of them to the point where it's practical to keep them triaged. Domen is working on getting a part-time position funded to work on issues here (https://opencollective.com/nix-macos), though individual package breaks are probably down the list.
nixpkgs CI does check for buildability on Darwin, which can be confirmed by looking at any of their PRs. However, packages do tend to be get marked as broken on Darwin if it doesn’t build and the packager doesn’t own a Mac.
I feel things have stabilized significantly in recent days, though. I haven’t had a single Darwin breakage on the unstable channel since the release of 20.09. Perhaps the Zero Hydra Failures effort[1] helped.
I think what I meant was darwin failure doesn't block.
Recently I had nomad breakage on -unstable caused by nvml support, which pulls in nvidia_x11, which pulls in linux_5_4, which of course not installable on darwin[1]. The maintainer fixed it very quickly (thank you!) but I still need to wait few more days for it to be included in -unstable.
https://google.com/?q=nix+on+mac+os+x
Nix has more packages than MacPorts - 60k vs 37.6k - though that's not necessarily a guarantee the ones you need are there.
And like MacPorts it doesn't do weird, non-Unix-y ownership changes of system directories like Homebrew does.