FreeBSD pkg¶
- ID
pkg- Links
- Upstream stars
⭐ 827
- Last commit
2026-09-28
- Version requirement
>= 1.11
- Platforms
🅱️ BSD (FreeBSD only)
- Operations
installed·outdated·orphans·search·install·upgrade·upgrade_all·remove·sync·cleanup·doctor- purl types
pkg:pkg/- CLI name
pkg- Issues and PRs
- Source
FreeBSD’s binary pkg frontend, fetching pre-compiled artifacts from the official FreeBSD repository.
Only root may modify the package database, so mutating operations escalate
through sudo by default, like the Ports sibling.
What mpm adds to pkg¶
mpm reaches across every manager at once, not pkg alone: mpm installed and mpm outdated cover pkg 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 commands, in mpm¶
You already know pkg: 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 |
|
|
Install a package |
|
|
Upgrade one package |
|
|
Upgrade everything |
|
|
Remove a package |
|
|
List orphaned dependencies |
|
|
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 |
Notes |
|---|---|---|
|
✅ |
|
|
✅ |
|
|
✅ |
|
|
✅ |
|
|
✅ |
A package already installed as a dependency is marked explicit by |
|
✅ |
|
|
✅ |
|
|
✅ |
|
|
✅ |
|
|
✅ |
The |
|
✅ |
Configuration¶
Ignore
pkgon thempmCLI by passing the--no-pkgoption.Ignore it for every run in your configuration:
[mpm] pkg = false
Raise the timeout of all
pkgcalls:[mpm.overrides.pkg] timeout = 900
Run
mpm config-template pkgto print all overridable settings for your configuration file:[mpm.overrides.pkg] cli_names = [ "pkg", ] cli_search_path = [] dry_run = false ignore_auto_updates = true plan = false post_args = [] pre_args = [] pre_cmds = [] requirement = ">=1.11" stop_on_error = false unmaintained = false version_cli_options = [ "--version", ] version_regexes = [ "(?P<version>\\S+)", ]
Recipes¶
A few jobs you would otherwise script around pkg, one mpm command each:
Snapshot and clone a machine:
mpm --pkg dump pkg.toml, thenmpm restore pkg.tomlon the next one.Export a compliance SBOM:
mpm --pkg sbom(CycloneDX by default,--spdxfor SPDX).Gate CI on health:
mpm --pkg doctorrelays FreeBSD pkg’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.
Concurrency¶
mpm never runs pkg at the same time as ports: ports keeps no registry of its own and registers what it builds through pkg, whose advisory lock on that shared install database refuses a second writer. Each mutating operation waits for the previous one, even with a higher --jobs, while managers outside this group keep running in parallel.
Only mutations are held back. The read-only queries (installed, outdated, search) take no backend lock and stay fully concurrent.
Cooldown¶
State of FreeBSD pkg’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: 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 againstftp.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 manager source. If you know FreeBSD pkg well and a transcript below looks wrong, or a newer release changed its output format, report it.
$ pkg query "%n %v %c"
7-zip 21.07_2 Console version of the 7-Zip file archiver
ap24-mod_mpm_itk 2.4.7_2 Run each vhost under a separate uid and gid
apache24 2.4.57 Version 2.4.x of Apache web server
aquantia-atlantic-kmod 0.0.5_1 Aquantia AQtion (Atlantic) Network Driver
arcconf 3.07.23971,1 Adaptec SCSI/SAS RAID administration tool
areca-cli-amd64 1.14.7.150519,1 Command Line Interface for ARC-xxxx RAID
base64 1.5_1 Utility to encode and decode base64 files
bash 5.1.12 GNU Project's Bourne Again SHell
beadm 1.4_1 Solaris-like utility to manage Boot Environments on ZFS
$ pkg upgrade --quiet --dry-run
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (312 candidates): 100%
Processing candidates (312 candidates): 100%
The following 466 package(s) will be affected (of 0 checked):
Installed packages to be REMOVED:
freenas-files: 13.0_1700495253
py39-midcli: 20190509171453
py39-middlewared: 13.0_1700495253
New packages to be INSTALLED:
abseil: 20230125.3 [FreeBSD]
argp-standalone: 1.5.0 [FreeBSD]
brotli: 1.1.0,1 [FreeBSD]
Installed packages to be UPGRADED:
7-zip: 21.07_2 -> 23.01 [FreeBSD]
apache24: 2.4.57 -> 2.4.58_1 [FreeBSD]
apr: 1.7.0.1.6.1_1 -> 1.7.3.1.6.3_1 [FreeBSD]
aquantia-atlantic-kmod: 0.0.5_1 -> 0.0.5_2 [FreeBSD]
bash: 5.1.12 -> 5.2.21 [FreeBSD]
$ pkg autoremove --quiet --dry-run
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 2 packages:
Installed packages to be REMOVED:
libiconv: 1.17
pcre: 8.45_3
Number of packages to be removed: 2
Version check¶
The version is extracted from the output of pkg --version with:
r"(?P<version>\S+)"
Upstream project¶
Metrics |
|
|---|---|
Activity |
|
Popularity |
|
Metadata |
|
Changelog¶
8.0.0(2026-09-20)Mark a package already installed as a dependency as explicitly installed when
mpm installormpm restorenames it, sompm cleanup --orphanskeeps it.Stop running
portsconcurrently withpkg, which holds the advisory lock on the install database both register into.Warn and report no package, instead of crashing, when a JSON listing cannot be parsed.
Fix every operation on FreeBSD, where
pkgrejects the global--quietit was passed, and repairsearch, which omitted its subcommand and mis-parsed the results.
7.6.1(2026-08-11)Fix the
pkg(8)andports(7)man-page references rendering as broken markup on the manager’s documentation page.
7.4.0(2026-07-25)Plain
cleanupno longer removes orphaned packages: their native sweeps moved behindcleanup --orphans. This also stopsemerge’s cleanup from triggering its pre-depclean world upgrade unless--orphansis given.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.installednow lists every package registered in the pkg database instead of only explicitly-requested ones: the%a = 0automatic-flag filter is dropped, and the query invocation loses the literal quote characters it carried, aligning it with theportsinvocation reading the same database.
6.2.0(2026-03-25)Add
--quietoption to allpkginvocations to reduce log verbosity.
5.15.0(2024-02-25)Add support for
pkgon FreeBSD.