MacPorts is the older sibling. It's been around since 2002 (originally called DarwinPorts), pre-dating Homebrew by seven years. It serves a smaller but loyal community — and on the right kind of project, it's still the better tool.
Three things make MacPorts distinct from Homebrew. First, it builds from source by default. When you sudo port install python312, MacPorts compiles Python on your Mac with your toolchain. That's slower than Homebrew's binary bottles, but it gives you reproducible builds keyed to your exact macOS+architecture, and it lets you customize the build.
Second, MacPorts is fully self-contained. It bundles its own copies of every dependency — its own OpenSSL, its own readline, its own zlib. It never reaches into macOS system libraries. That makes MacPorts setups more isolated from macOS upgrades — when Apple changes a system library, your MacPorts tools usually don't notice.
Third, MacPorts uses variants — build-time options you can flip per port. Want vim with Python 3.12 support but no X11? sudo port install vim +python312 -x11. Need GCC with Fortran? sudo port install gcc14 +fortran. Homebrew formulae generally don't expose this level of build-time control.
In exchange you accept three trade-offs. MacPorts requires sudo for almost everything (Homebrew never does). Builds are slower (compiling vs downloading). And the community is smaller, so weird third-party tools are sometimes missing. Use MacPorts when build customization or isolation matters; use Homebrew when speed and breadth matter.