.\" Generated by scdoc 1.11.5 .\" Complete documentation for this program is not available as a GNU info page .ie \n(.g .ds Aq \(aq .el .ds Aq ' .nh .ad l .\" Begin generated content: .TH "apk\-add" "8" "2026\-08\-31" .PP .SH NAME .PP apk add \- add or update constraints to \fIworld\fR and commit changes .PP .SH SYNOPSIS .PP \fBapk add\fR [<\fIoptions\fR>.\&.\&.\&] [\fIconstraints\fR|\fIfile\fR].\&.\&.\& .PP .SH DESCRIPTION .PP \fBapk add\fR adds or updates given constraints to \fIworld\fR (see \fBapk\-world\fR(5)) and commit changes to disk.\& This usually involves installing new packages, but may also cause other changes to the installed packages.\& .PP To upgrade individual packages without modifying \fIworld\fR use \fBapk\-fix\fR(8).\& .PP By default \fBapk\fR 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.\& .PP If a \fIfile\fR is added, a constraint against the package identity hash will be add.\& This constraint ensure that the exact file gets installed and kept.\& To later upgrade or downgrade back to a repository version, use \fBapk upgrade \-\-available\fR.\& .PP .SH OPTIONS .PP \fBapk add\fR supports the commit options described in \fBapk\fR(8), as well as the following options: .PP \fB\-\-initdb\fR .RS 4 Initialize a new package database.\& .PP .RE \fB\-\-latest\fR, \fB\-l\fR .RS 4 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.\& .PP .RE \fB\-\-no\-chown\fR .RS 4 Deprecated alias for \-\-usermode.\& .PP .RE \fB\-\-upgrade\fR, \fB\-u\fR .RS 4 Upgrade \fIpackages\fR and their dependencies.\& Normally \fBapk add\fR will avoid changing installed package unless it is required by the newly added \fIpackages\fR or their dependencies.\& This changes the default preference to upgrading the package to the latest installable version.\& .PP .RE \fB\-\-usermode\fR .RS 4 Create usermode database with \-\-initdb.\& In usermode, apk will operate in such a way that root access is not required.\& Currently this implies: .PD 0 .IP \(bu 4 checking that we are running as non\-root .IP \(bu 4 not changing file owner or group .IP \(bu 4 not setting system xattrs .PD .PP This implies that the installation might not be fully functional.\& However, this is useful mode for testing purposes or to create chroot where some specific applications can run as non\-root.\& .PP .RE \fB\-\-virtual\fR, \fB\-t\fR \fINAME\fR .RS 4 Create virtual package \fINAME\fR with given dependencies.\& This new package will get the \fIpackages\fR as dependencies instead of \fIworld\fR.\& Finally the \fINAME\fR is added to \fIworld\fR.\& An optional version specifier for the virtual package can be given via syntax \fINAME\fR=\fIVERSION\fR.\& The version defaults to synthesized version based on time.\& .PP One can use this to ensure that selected set of packages are installed, and later the temporary modification be undone with \fBapk\-del\fR(8) \fINAME\fR without removing packages that were installed earlier.\& .RE