ADDPKG(8) System Manager's Manual ADDPKG(8)

addpkg — install or upgrade a package

addpkg [-fu] [-r root] package

addpkg -h | -v

addpkg installs the package archive package, as built by mkpkg(8). Name and version are taken from the file name, name#version-release.pkg.tar.ext. It must be run as root.

The installation runs these steps, in order:

  1. Check the package against its footprint; see FOOTPRINT GUARD.
  2. Lock the package database. Refuse if the same version is installed, if another version is installed and -u is not given, or if -u is given and the package is not installed.
  3. Refuse if a file in the package belongs to another installed package. Directories may be shared.
  4. Create the groups and users declared in the package metadata, so that files can be owned by them.
  5. Extract the archive; see CONFIGURATION FILES.
  6. On upgrade, remove files of the old version that the new one no longer has, unless another package owns them. Files under etc/ are kept and reported.
  7. Record the package in the database.
  8. Run ldconfig(8) if the root has /sbin/ldconfig, then the triggers; see TRIGGERS.
  9. Enable the declared services, then apply the declared permissions and file capabilities. User and group names in the permissions are looked up in the root's /etc/passwd and /etc/group.

The metadata is described under groups, services, permissions and capabilities in MAKEPKG(5).

The options are as follows:

Force: skip the footprint guard, allow file conflicts, and reinstall a version that is already installed. Forcing a different version than the installed one is an upgrade, as with -u.
Print a usage summary.
root
Install into root instead of /. Groups, users and triggers are handled by commands run with chroot(8) into root.
Upgrade an installed package to a different version.
Print the version.

If the directory holding package also holds a .footprint, the package is compared with it before anything is installed. If that directory is a locked port, with a MAKEPKG.lock, .footprint.lock is used instead. Without a footprint file the check is skipped. A footprint file that cannot be read, or a package whose contents cannot be listed, blocks the installation.

Entries are reported under “changed”, “missing” and “new”. Changed and missing entries always block the installation. New entries block it unless IGNORE_NEW=yes is set in /etc/mkpkg.conf. -f skips the check.

On a fresh install every file is extracted.

On an upgrade, a file under etc/ that already exists is left alone and the new one is placed beside it as file.new, unless the two are identical. The staged files are listed.

On a forced reinstall of the same version, existing files under etc/ are not touched; missing ones are installed. They stay in the database either way.

After the files are in place, addpkg runs a command for each kind of path the operation added or removed. Each command runs at most once, is announced on standard error, and is skipped quietly if it is not installed.

lib/modules/version/
version, for each version whose directory exists.
boot/, usr/share/limine/
.
usr/lib/udev/hwdb.d/, etc/udev/hwdb.d/
.
usr/share/fonts/
.
usr/share/glib-2.0/schemas/
.
usr/lib/gdk-pixbuf-2.0/
.
usr/share/mime/
.
usr/share/icons/
.
usr/share/applications/
.
etc/sv/service/
On upgrade only: sv restart /etc/sv/service, if the service is running.

Installation root if -r is not given.
Package database directory. An absolute path is used as it is, a relative one below the root. Default: /var/lib/pkg.
Directory for temporary files. Default: /tmp.

/var/lib/pkg/db
Package database.
/var/lib/pkg/meta/name
Package metadata.
/etc/mkpkg.conf
Read for IGNORE_NEW; see mkpkg.conf(5).

The addpkg utility exits 0 on success, and >0 if an error occurs.

Install a freshly built package from its port directory:

# addpkg /usr/ports/core/zlib/zlib#1.3.1-1.pkg.tar.gz

Upgrade it:

# addpkg -u /usr/ports/core/zlib/zlib#1.3.2-1.pkg.tar.gz

MAKEPKG(5), mkpkg.conf(5), delpkg(8), infopkg(8), mkpkg(8), pkg(8)

September 27, 2026 mkpkg 1.6.0