MacPorts

MacPorts (https://www.macports.org) is a source-based ports system for macOS: it builds and installs packages under its own /opt/local prefix (the port binary lives at /opt/local/bin/port), isolated from the system.

Parsing notes:

  • port -q installed reports only active ports: the (active) anchor in the installed regex skips the inactive versions MacPorts keeps around, and the version capture stops at the first “+” so variant suffixes (“@3.12.3_0+lzma+optimizations”) stay out of the version.

  • port -q outdated prints name installed < latest rows; the < arrow separates the current version from the available one.

  • port search --line prints tab-separated “name version category description” rows; the {extended_args} template maps mpm’s --extended to --description and {exact_args} maps --exact, both sitting before the trailing --line {query}.

  • Home page: https://www.macports.org

  • Source: meta_package_manager/managers/macports.toml

  • Version requirement: >=2.0.0

Platforms

  • 🍎 macOS

Operations

Operation

Supported

installed

outdated

search

install

upgrade

upgrade_all

remove

sync

cleanup

Ecosystem

  • Accepted purl types: pkg:macports

Usage

$ mpm --macports installed
$ mpm --macports search "query"
$ mpm --macports upgrade --all
$ mpm install pkg:macports/hello
$ mpm --dry-run --macports upgrade --all

Every example above accepts --dry-run, which simulates the underlying manager calls without touching the system: the safe way to watch what mpm would do before trusting it.

Deselect the manager for a single run with --no-macports, disable it from your configuration, or tune its invocation attributes with per-manager overrides.

Command line

  • CLI names, in lookup order: port

  • Extra CLI search paths: /opt/local/bin

The version is probed by running:

$ port version
Version: 2.12.4

and extracted with:

r"Version:\s+(?P<version>\S+)"

Privilege escalation

mpm runs this manager as the current user and never prepends sudo by default. Flip the policy for its privileged operations with --sudo or the per-manager sudo override.

None of its operations needs root.

See privilege escalation for the full policy.

Cooldown

State of MacPorts’s release-age gating, from the cooldown support table:

  • Status: ❌ None

With --cooldown set, mpm skips this manager’s install and upgrade operations rather than run them unguarded (fail-closed); --allow-unsupported-managers opts back in.

Reference traces

Raw native outputs captured in the bundled definition: the reference mpm’s parsers were written against. If you know MacPorts well and a transcript below looks wrong, or a newer release changed its output format, report it.

$ port -q installed
  curl @8.7.1_0 (active)
  python312 @3.12.3_0+lzma+optimizations (active)
  vim @9.1.0_0 (active)
$ port -q outdated
curl                            8.7.1_0 < 8.8.0_0
python312                       3.12.3_0 < 3.12.4_0
$ port search --name {extended_args} {exact_args} --line {query}
MacVim	9.1.1092	aqua	MacVim - VIM for macOS
vim	9.1.1092	editors	Vi IMproved