OpenBSD pkg tools

OpenBSD’s pkg tools are the base system’s package suite, spanning three binaries: pkg_info (queries), pkg_add (install/upgrade) and pkg_delete (remove/cleanup).

Parsing notes, verified against the pkg_add/pkg_info/pkg_delete man pages (man.openbsd.org), the OpenBSD FAQ 15, and the OpenBSD::PkgInfo/Update Perl source:

  • None of the three binaries has a version flag (-V and -v mean progress/verbose): the suite ships with the base system and is versioned with the OS, so the version probe runs uname -r instead (like “7.7”).

  • Package names fuse “stem-version” with OpenBSD’s pN patch suffix and optional flavor tails (unzip-6.0p17, unzip-6.0p17-iconv): the version capture starts at the last dash before a digit and absorbs any flavor tail.

  • Packages are located through /etc/installurl, configured by default on modern OpenBSD: there is no local index to refresh, hence no sync operation. Outdated is omitted too: pkg_add -u -n -v interleaves progress meters and can list several candidates per package, which defeats per-line parsing.

  • -I forces non-interactive mode on every mutating call (the default is interactive on a terminal). Mutations need root: OpenBSD’s base convention is doas, but mpm’s escalation runs through sudo (available as a package).

  • Home page: https://man.openbsd.org/pkg_add

  • Source: meta_package_manager/managers/pkg_tools.toml

Platforms

  • 🅱️ BSD (OpenBSD only)

Operations

Operation

Supported

Notes

installed

outdated

search

exact and extended search backfilled by mpm

install

upgrade

upgrade_all

remove

sync

cleanup

Ecosystem

  • Accepted purl types: pkg:pkg-tools

Usage

$ mpm --pkg-tools installed
$ mpm --pkg-tools search "query"
$ mpm --pkg-tools upgrade --all
$ mpm install pkg:pkg-tools/hello
$ mpm --dry-run --pkg-tools 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-pkg-tools, disable it from your configuration, or tune its invocation attributes with per-manager overrides.

Command line

  • CLI names, in lookup order: pkg_info

  • Extra CLI search paths: /usr/sbin

The version is probed by running:

$ uname -r
7.7

and extracted with:

r"^(?P<version>[\d.]+)"

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, install, remove, upgrade, upgrade_all operations.

See privilege escalation for the full policy.

Cooldown

State of OpenBSD pkg tools’s release-age gating, from the cooldown support table:

  • Status: ❌ None (OpenBSD, per-release curated)

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 OpenBSD pkg tools well and a transcript below looks wrong, or a newer release changed its output format, report it.

$ pkg_info -I -a
unzip-6.0p17        Extract files from ZIP archives
lunzip-1.14p0       Lzip decompressor
$ pkg_info -Q {query}
lunzip-1.14p0
unzip-6.0p17 (installed)
unzip-6.0p17-iconv