MacPorts

ID

macports

Links

Home page · Documentation · Repository · Wikipedia

Upstream stars

⭐ 1,049

Last commit

2026-09-28

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

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

✅

Configuration

  • Ignore macports on the mpm CLI by passing the --no-macports option.

  • Ignore it for every run in your configuration:

    [mpm]
    macports = false
    
  • Raise the timeout of all macports calls:

    [mpm.overrides.macports]
    timeout = 900
    
  • Run mpm config-template macports to print all overridable settings for your configuration file:

    [mpm.overrides.macports]
    cli_names = [
        "port",
    ]
    cli_search_path = [
        "/opt/local/bin",
    ]
    dry_run = false
    ignore_auto_updates = true
    plan = false
    post_args = []
    pre_args = []
    pre_cmds = []
    requirement = ">=2.0.0"
    stop_on_error = false
    unmaintained = false
    version_cli_options = [
        "version",
    ]
    version_regexes = [
        "Version:\\s+(?P<version>\\S+)",
    ]
    

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.

Its privileged operations are cleanup, install, remove, sync, upgrade, upgrade_all.

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. A date declared in the manifest, like winget’s optional ReleaseDate, is author-supplied too and no sounder

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

Reference traces

A collection of raw native outputs captured from the manager’s own CLI and recorded in the bundled definition. 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

Version check

The version is probed by running:

$ port version
Version: 2.12.4

and extracted with:

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

Upstream project

Metrics

macports/macports-base

Activity

commit activity commits since open issues open pull requests

Popularity

forks watchers contributors

Metadata

latest release release date license main language

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.