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
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 cacheCommon 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
| Flag | What it does |
|---|---|
| -S | Sync (install) a package |
| -y | Refresh the package databases |
| -u | Upgrade installed packages |
| --noconfirm | Skip all prompts (required in CI) |
| --needed | Do not reinstall up-to-date packages |
| -Scc | Clean the entire package cache |