OpenBSD pkg tools

ID

pkg-tools

Links

Documentation · Repository

Upstream stars

⭐ 3,887

Last commit

2026-09-29

Platforms

🅱️ BSD (OpenBSD only)

Operations

installed · orphans · search · install · upgrade · upgrade_all · remove · cleanup

purl types

pkg:pkg-tools/

CLI name

pkg_info

Extra search paths

/usr/sbin

Issues and PRs

📦 manager: pkg-tools

Source

pkg_tools.toml

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).

What mpm adds to pkg-tools

Through mpm, pkg-tools gains --exact and --extended search, to narrow to exact names or match descriptions.

Bigger still, mpm reaches across every manager at once: mpm installed and mpm outdated cover pkg-tools 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 pkg-tools commands, in mpm

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

To…

With pkg-tools

With mpm

List what’s installed

pkg_info -I -a

mpm --pkg-tools installed

Search for a package

pkg_info -Q <query>

mpm --pkg-tools search <query>

Install a package

pkg_add -I <package_id>

mpm install pkg:pkg-tools/<package_id>

Upgrade one package

pkg_add -u -I <package_id>

mpm --pkg-tools upgrade <package_id>

Upgrade everything

pkg_add -u -I

mpm --pkg-tools upgrade --all

Remove a package

pkg_delete -I <package_id>

mpm remove pkg:pkg-tools/<package_id>

List orphaned dependencies

pkg_delete -a -I -n

mpm --pkg-tools orphans

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

Notes

installed

✅

outdated

orphans

✅

search

✅

Exact and extended search backfilled by mpm.

install

✅

upgrade

✅

upgrade_all

✅

remove

✅

sync

cleanup

✅

The --orphans flag runs the system-wide orphan sweep.

doctor

Configuration

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

  • Ignore it for every run in your configuration:

    [mpm]
    pkg-tools = false
    
  • Raise the timeout of all pkg-tools calls:

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

    [mpm.overrides.pkg-tools]
    cli_names = [
        "pkg_info",
    ]
    cli_search_path = [
        "/usr/sbin",
    ]
    dry_run = false
    ignore_auto_updates = true
    plan = false
    post_args = []
    pre_args = []
    pre_cmds = []
    stop_on_error = false
    unmaintained = false
    version_cli_options = [
        "-r",
    ]
    version_regexes = [
        "^(?P<version>[\\d.]+)",
    ]
    

Recipes

A few jobs you would otherwise script around pkg-tools, one mpm command each:

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

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

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

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)

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: Distro binary archives (pkg:deb, pkg:rpm, pkg:alpm, pkg:apk)

  • Retraction: Index revert: removal is an archive operation and the mirror is rebuilt without the package. Debian, for one, requires filing an RM: bug against ftp.debian.org (developers-reference)

  • Publish date: ❌ the version string is the distro maintainer’s build, carrying no upstream publication date

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 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_delete -a -I -n
autoconf-2.71p2: ok
automake-1.16.5: ok
$ pkg_info -Q {query}
lunzip-1.14p0
unzip-6.0p17 (installed)
unzip-6.0p17-iconv

Version check

The version is probed by running:

$ uname -r
7.7

and extracted with:

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

Upstream project

Metrics

openbsd/src

Activity

commit activity open issues open pull requests

Popularity

forks watchers contributors

Metadata

license main language

Changelog

  • 7.4.0 (2026-07-25)

    • Their cleanup commands, both orphan sweeps (cave purge, pkg_delete -a), are re-declared as cleanup_orphan: cleanup --orphans now reaches them and cleanup --cache leaves them alone.

    • Plain cleanup no longer removes orphaned packages: their native sweeps moved behind cleanup --orphans. This also stops emerge’s cleanup from triggering its pre-depclean world upgrade unless --orphans is given.

  • 7.2.0 (2026-07-09)

    • Add OpenBSD’s pkg tools (pkg_add/pkg_info/pkg_delete) with installed, search, install, upgrade, remove and cleanup support; a bundled configuration-defined manager.