MacPorts

ID

macports

Home page

https://www.macports.org

Version requirement

>= 2

Platforms

🍎 macOS

Operations

installed · outdated · search · install · upgrade · upgrade_all · remove · sync · cleanup · doctor

purl types

pkg:macports

CLI name

port

Extra search paths

/opt/local/bin

Issues and PRs

📦 manager: macports

Source

meta_package_manager/managers/macports.toml

MacPorts 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}.

  • The standard MacPorts install owns /opt/local as root and port does not self-escalate: mutating operations fail with “Insufficient privileges” as a plain user, so they escalate through sudo by default (sudo port install, the invocation every MacPorts guide documents). A user-prefix (non-root) MacPorts build can opt out with --no-sudo or a sudo = false override.

What mpm adds to macports

mpm reaches across every manager at once, not macports alone: mpm installed and mpm outdated cover macports alongside every other manager you run in one table, mpm upgrade --all updates them together, and mpm sbom exports the whole machine as one bill of materials.

Every mpm command also gains --dry-run and --plan previews, cross-scheme version comparison and purl identifiers. See manager augmentations for how each one is built.

Your macports commands, in mpm

You already know macports: each operation maps one-to-one onto mpm, in an interface shared by every manager.

To…

With macports

With mpm

List what’s installed

port -q installed

mpm --macports installed

List outdated packages

port -q outdated

mpm --macports outdated

Search for a package

port search --name <extended_args> <exact_args> --line <query>

mpm --macports search <pkg>

Install a package

port install <package_id>

mpm install pkg:macports/<package_id>

Upgrade one package

port upgrade <package_id>

mpm --macports upgrade <package_id>

Upgrade everything

port upgrade outdated

mpm --macports upgrade --all

Remove a package

port uninstall <package_id>

mpm remove pkg:macports/<package_id>

Clear caches

port clean --all installed

mpm --macports cleanup --cache

Run health checks

port diagnose --quiet

mpm --macports doctor

Prefix any command above with --dry-run to simulate the underlying manager calls without touching the system: the safe way to watch what mpm would do before trusting it.

Operations

Operation

Supported

installed

outdated

orphans

search

install

upgrade

upgrade_all

remove

sync

cleanup

doctor

Selecting and configuring macports

Deselect macports for a single run with --no-macports, or persist the choice in your configuration:

[mpm]
macports = false

Keep it enabled but tune how mpm drives it with a per-manager override:

[mpm.managers.macports]
timeout = 900

mpm config-template macports prints every overridable attribute as a ready-to-paste block.

Recipes

A few jobs you would otherwise script around macports, one mpm command each:

  • Snapshot and clone a machine: mpm --macports dump macports.toml, then mpm restore macports.toml on the next one.

  • Export a compliance SBOM: mpm --macports sbom (CycloneDX by default, --spdx for SPDX).

  • Gate CI on health: mpm --macports doctor relays MacPorts’s own diagnosis and exits non-zero on trouble.

Privilege escalation

System-wide manager: mpm wraps its privileged operations in sudo out of the box. Instead of letting the tool prompt mid-run, mpm primes the credential cache up-front, with a single branded password prompt at most. Turn escalation off for rootless setups with --no-sudo or the per-manager sudo override.

Root is required for its cleanup_cache, install, remove, sync, upgrade, upgrade_all operations.

See privilege escalation for the full policy.

Cooldown

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

Status: ❌ None

A cooldown only pays off where a compromised release can be withdrawn while the clock runs, and can only be emulated where the registry dates its releases. From the retraction table:

  • Registry: Git-manifest indexes

  • Retraction: Index revert: reverting the manifest, Portfile or derivation commit withdraws the version

  • Publish date: ❌ only the commit date, which is client-set and trivially backdated

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.

Version probe

The version is probed by running:

$ port version
Version: 2.12.4

and extracted with:

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

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

Feed any of these through mpm and the raw output becomes one uniform table, the same shape for every manager: filter it, project columns, or export it (mpm --macports installed --output json, or csv, toml, yaml), each package carrying a purl and a version comparable across managers.

Changelog

  • 7.4.0 (2026-07-25)

    • Mutating operations now escalate through sudo by default, matching each tool’s canonical invocation (sudo port install, sudo pkg install, sudo snap install): MacPorts installs root-owned under /opt/local, the FreeBSD pkg frontend gains the markers its ports sibling already had, and snapd denies state changes from an unprivileged client. Opt out with --no-sudo or a per-manager sudo = false override. pkg passes IGNORE_OSVERSION as a command-line option now, which survives the sudo environment reset where the environment variable would be stripped.

  • 7.3.0 (2026-07-17)

    • Convert from a Python class to a bundled configuration definition, the native exact/extended search switches declared through the new refinement templates. The optional description column of its search results is no longer populated.

  • 6.4.0 (2026-04-27)

    • Add MacPorts package manager with installed, outdated, search, install, upgrade, remove, sync, and cleanup support.