MacPorts is the best Package Manager

MacPorts is the best package manager for OSX. It has been around for decads, and compatability is good. The big elephant in the room is the other package manager for Mac homebrew. MacPorts has some benefits over homebrew and we will get back to that in a minute.

What a Package Manager Is

A package manager is a software meant to install and upgrade other software. To be a full blown package manager must have a command line interface. The tradition of package managers comes from the linux world. In the linux world most software has the command line as their only interface.

Mac has had the Apple App Store for ages. It also installs software through a software. In principle it is the same. Apple App Store does not come with command line programs. That is why MacPorts and App Store complements each other.

What It Means to be Best

Being the best package manager is not hard any more. After all there is just one competitor fink. I can not say that I have tested fink just yet.

I know everyone these days loves Homebrew. Once you read their installation you can see they require macos 12, and their reference to tigerbrew is just a joke. Tigerbrew is poorly tested and has very little software in their repositories.

Too bad Homebrew does not work on OSX. It is easy to use and contains all you can need.

Usage

Once you have installed macports you get the CLI up and running.

Browsing software is best done on the Available Ports section or via the command line with port search packagename.

Available Ports

For example. When I search for curl I get this

port search curl
coeurl @0.3.0_1 (net, www)
    Simple library to do http requests asynchronously via CURL in C++

curl @8.3.0 (net, www)
    Tool for transferring files with URL syntax

curl-ca-bundle @8.3.0 (net)
    CA certificate bundle for curl
... TRUNCATED ...

Found 59 ports.

Installing software is just a matter of doing

sudo port install curl
Password:
--->  Computing dependencies for curl
--->  Cleaning curl
--->  Updating database of binaries
--->  Scanning binaries for linking errors
      [                                        ]  82.8 %

The software you install just works.

Variants

But some of the software you are used to is not available. What is available can be found on macports web site. Search up the package you plan to install and you get this page for the package.

Take curl for example. Under the Port Health table you can see curl is built an tested on all Mac operating systems all the way down to Leopard (ppc legacy). Nice!

curl on MacpPorts

You also see that curl has a lot of Variants. Variants are different extensions to the original software that you can choose to install. For example you can install a version of curl with the http2 variant for HTTP/2 protocol support or rtmp variant for support RTMP media streams.

You can first install the standard package (e.g. port install curl), and later on install a variant (e.g. port install curl +http2 +rtmp) without having to reinstall the original package. On older systems saves time installing and compiling the package from source for a second time.

Variants is unlike anything other package managers have. With variants there is no reason to install more sofware than you need. For secrity services on the internet this is great. With less extensions, addons or plugins there is less software to attack.

Finishing Thoughs

I firmly love MacPorts. If a software shows up on MacPorts is well tested, and adopted for the system it runs on. No need to git clone, read a curious new readme and get familiar with a new build system.

If I could give every macports tester, maintainer and developer a hug one by one by one I would. MacPorts saves me a lot of time.

However on a modern MacOS Sonoma Homebrew is the king. It has more software in their repostiories. It does not need to compile anything from sources. Homebrew is so big that even Microsoft has started shipping their azure-cli tool on homebrew for the Mac.

I still find the variants concept really compelling. Next time I install a web server on a mac I would definetly go with MacPorts.