MacPorts¶
- ID
macports- Home page
- 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
- Source
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 installedreports 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 outdatedprintsname installed < latestrows; the<arrow separates the current version from the available one.port search --lineprints tab-separated “name version category description” rows; the {extended_args} template maps mpm’s--extendedto--descriptionand {exact_args} maps--exact, both sitting before the trailing--line {query}.The standard MacPorts install owns /opt/local as root and
portdoes 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-sudoor asudo = falseoverride.
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 |
With |
|---|---|---|
List what’s installed |
|
|
List outdated packages |
|
|
Search for a package |
|
|
Install a package |
|
|
Upgrade one package |
|
|
Upgrade everything |
|
|
Remove a package |
|
|
Clear caches |
|
|
Run health checks |
|
|
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 |
|---|---|
|
✓ |
|
✓ |
|
|
|
✓ |
|
✓ |
|
✓ |
|
✓ |
|
✓ |
|
✓ |
|
✓ |
|
✓ |
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, thenmpm restore macports.tomlon the next one.Export a compliance SBOM:
mpm --macports sbom(CycloneDX by default,--spdxfor SPDX).Gate CI on health:
mpm --macports doctorrelays 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
sudoby default, matching each tool’s canonical invocation (sudo port install,sudo pkg install,sudo snap install): MacPorts installs root-owned under/opt/local, the FreeBSDpkgfrontend gains the markers itsportssibling already had, and snapd denies state changes from an unprivileged client. Opt out with--no-sudoor a per-managersudo = falseoverride.pkgpassesIGNORE_OSVERSIONas a command-line option now, which survives thesudoenvironment 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, andcleanupsupport.