Skip to content
Latchkey

pacman -S: Usage, Options & Common CI Errors

pacman -S installs packages on Arch Linux and its derivatives.

pacman is Arch Linux's package manager. Arch is a rolling release, which creates a CI-specific hazard: a partial upgrade (-Sy without -u) can leave the system inconsistent and break installs.

What it does

pacman -S installs packages from the synced repositories. -y refreshes the package databases and -u upgrades the system. Because Arch rolls forward continuously, the safe pattern is -Syu (sync, refresh, full upgrade) rather than just -Sy, which risks a partial upgrade.

Common usage

Terminal
pacman -Sy --noconfirm                          # refresh databases
pacman -Syu --noconfirm                          # full upgrade (recommended)
pacman -S --noconfirm git base-devel
pacman -S --needed --noconfirm curl              # skip if up to date
pacman -Scc --noconfirm                          # clear the package cache

Common errors in CI

The classic Arch trap: pacman -Sy package without -u does a partial upgrade and can pull a new lib that mismatches installed packages, causing later "error: failed to commit transaction (conflicting files)" or runtime breakage - use -Syu. "error: failed retrieving file ... from mirror" means a stale base image database; -Sy first. "target not found: X" is a wrong name or a package now in the AUR (not in the official repos, which pacman alone cannot install). Always pass --noconfirm in CI to avoid prompts.

Options

FlagWhat it does
-SSync (install) a package
-yRefresh the package databases
-uUpgrade installed packages
--noconfirmSkip all prompts (required in CI)
--neededDo not reinstall up-to-date packages
-SccClean the entire package cache

Related guides

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