pkg

package manager for krypt/sh

Synopsis

pkg [ -r root ] [ -N ] [ -v ]

command

[ args ]

Description

pkg is the high-level package manager for krypt/sh. It resolves dependencies, drives mkpkg(8) for building, and calls addpkg(8) / delpkg(8) for installation and removal. Port directories are searched in the order defined in pkg.conf(5). When multiple ports provide the same package, the last matching directory wins.

Commands

Package Operations

add pkg ...
Install one or more packages and their dependencies. Builds from source if no binary archive exists.
del pkg ...
Remove one or more installed packages. Continues on failure when multiple packages are specified.
list
List all installed packages with their versions.
isinst pkg
Check if a package is installed. Prints name version and exits 0 if installed, exits 1 if not. Suitable for scripting.
update pkg
Update a package to the version in the ports tree. Resolves and updates dependencies as needed.
prepare [pkg]
Install build dependencies (makedeps) for a port. If no package is given, operates on the current directory.
build [pkg]
Build a package without installing it. If no package is given, operates on the current directory.

System Operations

sysup
Update all outdated packages. Compares installed versions against the ports tree and upgrades each outdated package in dependency order.
autoremove
Remove orphaned packages — packages that were installed as dependencies but are no longer required by any installed package.
diff
Show version differences between installed packages and the ports tree.
revdep
Check installed packages for broken shared library dependencies. Calls revdep(8) directly, passing any additional arguments through.

Query Operations

depends pkg
Show the dependency tree for a package.
rdepends pkg
Show reverse dependencies — packages that depend on pkg .
orphans
List packages that are not required by any other installed package.

Database Operations

initdb
Populate the dependency database from installed packages. Run once after initial installation or when the database is missing or corrupted.
checkdb
Verify the dependency database for consistency. Reports stale entries and untracked packages.

Lock Operations

lock pkg
Lock a package to prevent sysup from updating it.
unlock pkg
Unlock a previously locked package.
locked
List all locked packages.

Options

-r path, --root path
Alternative installation root. Passed through to addpkg(8) and delpkg(8).
-N, --no-deps
Operate on the specified package only, without resolving or installing dependencies.
-v, --verbose
Verbose output.

Files

/etc/pkg.conf
Package manager configuration. See pkg.conf(5).
/var/lib/pkg/deps.db
Dependency database.
/var/lib/pkg/locked
List of locked packages.
/var/lib/pkg/db
Package database (shared with pkgtools).

Exit Status

0 on success, 1 on error.

Examples

pkg add firefox              # install with dependencies
pkg add zlib libressl        # install multiple packages
pkg del firefox              # remove a package
pkg del zlib libressl        # remove multiple packages
pkg list                     # list all installed packages
pkg isinst openssl           # check if openssl is installed
pkg update openssl           # update single package
pkg sysup                    # update entire system
pkg prepare                  # install makedeps for cwd port
pkg diff                     # see what's outdated
pkg depends mesa             # show mesa's dep tree
pkg rdepends openssl         # who depends on openssl
pkg lock rust                # prevent rust from being updated
pkg autoremove               # clean up orphans
pkg revdep                   # check for broken library deps
pkg revdep -r mesa-amdgpu    # what depends on mesa-amdgpu

See Also

LLVM musl libc libressl Independent