Skip to content
Latchkey

makepkg: Usage, Options & Common CI Errors

makepkg builds an Arch Linux .pkg.tar.zst package from a PKGBUILD recipe.

makepkg is Arch’s package builder. The infamous CI snag is that it refuses to run as root - which is exactly what most container images give you - so the standard fix is a dedicated build user.

What it does

makepkg reads a PKGBUILD, downloads and verifies sources, runs the build() and package() functions in a fakeroot environment, and produces a compressed .pkg.tar.zst package installable with pacman.

Common usage

Terminal
makepkg -s                         # build, install missing deps
makepkg -si                        # build then install
makepkg -f --noconfirm             # force rebuild, no prompts
useradd -m build && sudo -u build makepkg -s   # not as root
makepkg --printsrcinfo > .SRCINFO

Options

FlagWhat it does
-s / --syncdepsInstall missing dependencies via pacman
-i / --installInstall the built package
-f / --forceOverwrite an existing built package
--noconfirmSkip interactive prompts (for CI)
--skippgpcheckSkip source PGP signature verification

Common errors in CI

"ERROR: Running makepkg as root is not allowed as it can cause permanent, catastrophic damage to your system." - create an unprivileged user and run via sudo -u build makepkg (root containers hit this immediately). "==> ERROR: ‘pacman’ failed to install missing dependencies" - run pacman -Sy first or pass -s with a synced db. Always add --noconfirm in CI or makepkg hangs on a prompt. "One or more PGP signatures could not be verified" - import the key or, only if trusted, --skippgpcheck.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →