newline

Table of Contents

  1. Basic concepts
  2. Installing software
    1. Searching for software
    2. Showing information about a port
    3. Showing the variants a port has
    4. Showing dependencies of ports
    5. Installing a port
    6. Show notes for a port
    7. Mark a port as manually installed (‘requested’)
    8. Activate a version of a port
  3. Listing installed software
    1. List all installed ports
    2. List requested (manually installed) ports
    3. List files installed by a port
    4. List inactive ports
    5. List dependencies that are no longer used (leaves)
  4. Cleaning
    1. Delete intermediate files created while installing a port
    2. Remove inactive ports
    3. Reclaim space
    4. Remove unused dependencies
  5. Updating and upgrading
    1. Sync and update MacPorts
    2. Sync the local MacPorts repo
    3. Show outdated ports
    4. Upgrade outdated ports
    5. Find and report any issues

Switching from Homebrew to MacPorts

Mac, Shell

October 17, 2026

Judging by the attitude of Apple and many projects for macOS, my 15“ mid-2012 Macbook Pro should now be a fancy paperweight. Unfortunately, it just keeps working: currently it’s on macOS Sonoma (soon to be updated to Sequoia), and thanks to OpenCore Legacy Patcher, I can keep it up to date for at least a year or two more – at least until Sequoia stops receiving security patches, and maybe longer if OCLP gets support for Tahoe. However, just because it’s not an ARM machine, Homebrew and nixpkgs have both stopped supporting my computer and hence not providing any more prebuilt binaries, giving me the great options of either: 1) compiling everything from source, and dealing with the headaches of that (huge time sink, broken libraries, and other fun stuff), 2) never upgrading anything, or 3) buying a new laptop. None of those options are great.

Now to be clear, I’m not blaming Homebrew, nixpkgs, or any other open source project. They are projects run by volunteers in their free time, and supporting older machines with their limited resources is not possible. Furthermore, they need Intel Mac runners to build software for Intel Macs, and those runners won’t be available anymore either. I am frustrated with the way Apple is handling this. They don’t provide any financial support to projects like Homebrew (which I am almost certain that Apple engineers themselves use), and they don’t give owners of Intel Macs any alternative, other than buying a new machine and throwing the old one away. They built a massive market on Intel Macs, and now they expect everyone to toss them and buy the new shiny thing. But of course, one cannot let environmental concerns get in the way of good business.

Thankfully, there’s an alternative. MacPorts is a package manager for macOS that has been around long before Homebrew, which means it also supports much older operating systems, back to OS X Leopard (but also up to the newest macOS at the time of writing, Golden Gate). As of October 2026, it reports a total of just over 42 thousand packages in the repository – not too far off the 46.5 thousand in Debian and derivative repos.

I installed MacPorts using the MacPorts Guide, installed the same packages I had installed through Homebrew, and cleared out the Homebrew installation using their uninstall script. First impressions, MacPorts seems way faster and seems to have quite a good collection of software. I also kind of prefer their interface for package management over Homebrew’s. In this post, I collected the common commands for various tasks in MacPorts.

Basic concepts

A package is a ‘port’. A port can have ‘variants’, like features/compile flags. Prebuilt binaries are stored and automatically downloaded from packages.macports.org. MacPorts stores data in /opt/local/. An ‘active’ port is a port that’s actually present on disk and in use, while an ‘inactive’ port is stashed in a compressed tarball. When upgrading a port, the previous version doesn’t get removed automatically; it only gets deactivated, so that you can easily go back in case of a broken upgrade.

Installing software

Searching for software

port search something

This searches the name and description for “something”. If you only want to search the port name, pass the --name flag.

Showing information about a port

port info portname

Showing the variants a port has

port variants portname

Showing dependencies of ports

# What does portname depend on?
port depends portname

# What's the full dependency tree of portname?
port rdepends portname

# What depends on portname?
port dependents portname

Installing a port

# Install a port
sudo port install portname

# Install a port only if it's available as a prebuilt archive
sudo port -b install portname

# Install a port without variant1 and with variant2
sudo port install portname -variant1 +variant2

Show notes for a port

Notes are like caveats in Homebrew, they are also automatically shown on installation.

port notes portname

Mark a port as manually installed (‘requested’)

port setrequested portname

Activate a version of a port

sudo port activate portname @version

Listing installed software

List all installed ports

port installed

List requested (manually installed) ports

port installed requested

List files installed by a port

port contents portname

List inactive ports

Inactive ports are installed, but stashed in a compressed tarball and not in use.

port installed inactive

List dependencies that are no longer used (leaves)

port installed leaves

Cleaning

Delete intermediate files created while installing a port

sudo port clean portname

Remove inactive ports

sudo port uninstall inactive

Reclaim space

Reclaiming removes inactive ports and deletes intermediate installation files.

port reclaim

Remove unused dependencies

With the --follow-dependencies flag, it also removes any dependencies that become unused while this command runs.

sudo port uninstall --follow-dependencies leaves

Updating and upgrading

Sync and update MacPorts

Update local ports tree from MacPorts repository, and upgrade MacPorts itself.

sudo port selfupdate

Sync the local MacPorts repo

Only update the local MacPorts repo (e.g. Portfiles):

sudo port sync

Show outdated ports

# All
port outdated
# Only manually installed
port outdated requested

Upgrade outdated ports

sudo port upgrade outdated

Find and report any issues

port diagnose