apk-add(8) System Manager's Manual apk-add(8)

# [NAME](#NAME)

apk add - add or update constraints to *world* and commit changes

# [SYNOPSIS](#SYNOPSIS)

**apk add** \[&lt;*options*&gt;...] *constraints*...

# [DESCRIPTION](#DESCRIPTION)

**apk add** adds or updates given constraints to *world* (see [**apk-world**(5)](/man/os/apk-tools/apk-world.5)) and commit changes to disk. This usually involves installing new packages, but may also cause other changes to the installed packages.

To upgrade individual packages without modifying *world* use [**apk-fix**(8)](/man/os/apk-tools/apk-fix.8).

By default **apk** tries to select a set of packages so that all constraints are satisfied. This means that some packages can be held back in an older version if there is direct or implicit dependencies to the older version.

# [OPTIONS](#OPTIONS)

**apk add** supports the commit options described in [**apk**(8)](/man/os/apk-tools/apk.8), as well as the following options:

**--initdb**

Initialize a new package database.

**-l, --latest**

Always choose the latest package by version. However, the versions considered are based on the package pinning. Primarily this overrides the default heuristic and will cause an error to displayed if all dependencies cannot be satisfied.

**-u, --upgrade**

Upgrade *packages* and it's dependencies. Normally **apk add** will avoid changing installed package unless it is required by the newly added *packages* or their dependencies. This changes the default preference to upgrading the package to the latest installable version.

**-t, --virtual** *NAME*

Create virtual package *NAME* with given dependencies. This new package will get the *packages* as dependencies instead of *world*. Finally the *NAME* is added to *world*. An optional version specifier for the virtual package can be given via syntax *NAME*=*VERSION*. The version defaults to synthesized version based on time.

One can use this to ensure that selected set of packages are installed, and later the temporary modification be undone with [**apk-del**(8)](/man/os/apk-tools/apk-del.8) *NAME* without removing packages that were installed earlier.

**--no-chown**

Do not change file owner or group. By default apk will manage the file ownership when running as root. However, this option is turned on when running as non-root user, as changing file ownership is not permitted by the system then.

2026-10-27

---

Document: apk-add(8) from apk-tools 2.14.12-r0 (Chainguard OS)
Source: https://gitlab.alpinelinux.org/alpine/apk-tools.git
