Pkgin

ID

pkgin

Home page

https://pkgin.net

Platforms

🅱️ BSD (NetBSD only)

Operations

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

purl types

pkg:pkgin

CLI name

pkgin

Issues and PRs

📦 manager: pkgin

Source

meta_package_manager/managers/pkgin.toml

pkgin is the binary package manager for pkgsrc, NetBSD’s portable package collection (also used on illumos/SmartOS, macOS and Linux).

Parsing notes, verified against the pkgin 26.4.0 source (main.c, pkglist.c, messages.h) and its man page:

  • Global flags precede the command word (pkgin -y install foo); pkgin has no long options at all.

  • -p switches listings to a semicolon-delimited machine format (“name-version;comment”), used for installed and outdated. Plain search output is parsed with a fused “name-version” split on the last dash before a digit (pkgsrc versions may carry an “nbN” revision suffix, like “lbdb-0.48.1nb1”).

  • -l '<' filters the listing to packages whose installed version is older than the repository’s, printing the available version: a non-mutating outdated listing. It reflects the local summary database, so run mpm sync first.

  • Every non-empty search ends with a three-line “=:/<:/>:” legend footer, which matches nothing in the regex and is skipped.

  • Queries run unprivileged on the existing database; every mutating command (including update, which rebuilds the database) needs root.

What mpm adds to pkgin

Through mpm, pkgin 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 pkgin 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 pkgin commands, in mpm

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

To…

With pkgin

With mpm

List what’s installed

pkgin -p list

mpm --pkgin installed

List outdated packages

pkgin -p -l < list

mpm --pkgin outdated

Search for a package

pkgin search <query>

mpm --pkgin search <query>

Install a package

pkgin -y install <package_id>

mpm install pkg:pkgin/<package_id>

Upgrade one package

pkgin -y install <package_id>

mpm --pkgin upgrade <package_id>

Upgrade everything

pkgin -y upgrade

mpm --pkgin upgrade --all

Remove a package

pkgin -y remove <package_id>

mpm remove pkg:pkgin/<package_id>

Clear caches

pkgin clean

mpm --pkgin cleanup --cache

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

doctor

Selecting and configuring pkgin

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

[mpm]
pkgin = false

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

[mpm.managers.pkgin]
timeout = 900

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

Recipes

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

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

  • Export a compliance SBOM: mpm --pkgin 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.

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

See privilege escalation for the full policy.

Cooldown

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

Status: ❌ None (pkgsrc binary packages)

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); --allow-unsupported-managers opts back in.

Version probe

The version is probed by running:

$ pkgin -v
pkgin 26.4.0 (using SQLite 3.45.1)

and extracted with:

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

Reference traces

Raw native outputs captured in the bundled definition: the reference mpm’s parsers were written against. If you know Pkgin well and a transcript below looks wrong, or a newer release changed its output format, report it.

$ pkgin -p list
lbdb-0.48.1nb1;The little brother's database
mutt-1.14.5;Text-based MIME mail client
$ pkgin -p -l < list
abook-0.6.2;<;Text-based addressbook program
$ pkgin search {query}
abook-0.6.1          Text-based addressbook program
mutt-1.14.5 =        Text-based MIME mail client
=: package is installed and up-to-date
<: package is installed but newer version is available
>: installed package has a greater version than available package

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 --pkgin installed --output json, or csv, toml, yaml), each package carrying a purl and a version comparable across managers.

Changelog

  • 7.2.0 (2026-07-09)

    • Add pkgin (NetBSD pkgsrc) package manager with installed, outdated, search, install, upgrade, remove, sync and cleanup support; a bundled configuration-defined manager.