pacman -S: installing a package
To install a package, run sudo pacman -S <package>. pacman resolves the dependencies, shows what it will install and how large the download is, and waits for you to confirm.
sudo pacman -S <package>
-S- --sync — install packages from the repositories and upgrade the system
Needs root.
What it does. Install a package from the configured repositories, together with every dependency it needs.
Watch out. Install as part of a full upgrade — -Syu <package> — rather than after a bare refresh.
Step by step
- Find the exact package name
Package names have to match exactly, so search the repositories first rather than guessing at a spelling.
routinepacman -Ss <pattern> - Install it
Give pacman the name it printed. Dependencies are pulled in automatically and are recorded as dependencies rather than as explicit installs.
routinesudo pacman -S <package> - Confirm what landed
The query operation reads the local database, so it tells you the version that is now installed and what requires it.
routinepacman -Qi <package>
Naming a package that is already installed is not an error: it installs it again, which is what the reinstall page covers.
Several packages, and groups
Names are separated by spaces, and there is no limit worth worrying about:
sudo pacman -S <package> <package> <package>Some names are not packages but groups: a label that stands for a set of packages. Installing one offers the members and lets you pick a subset by number, or take the whole group by pressing Enter. To see what a group contains before installing anything:
pacman -Sg <group>Read-only, so no root is needed.
--needed: skip what is already installed
By default, naming a package that is already installed at the same version
reinstalls it. --needed skips those instead, which matters when the list is long or
scripted:
sudo pacman -S --needed <package> <package>Explicit installs and dependencies
pacman records why each package is on the machine. A package you name on the command line is recorded as explicitly installed; a package pulled in to satisfy a dependency is recorded as a dependency. That distinction is what makes orphan cleanup possible later, and you can set it yourself:
| Command | Effect |
|---|---|
sudo pacman -S --asdeps <package> | Install it but record it as a dependency, so it becomes removable once nothing needs it |
sudo pacman -D --asexplicit <package> | Change an already installed package to explicitly installed, so orphan cleanup leaves it alone |
pacman -Qe | List what is recorded as explicitly installed |
pacman -Qd | List what is recorded as a dependency |
-S and -U are different operations
| Operation | Installs from | Typical target |
|---|---|---|
-S | A configured repository, resolving dependencies from it | <package> |
-U | A package file already on disk or a file the mirror serves directly | <file>.pkg.tar.zst |
-U is what an AUR build ends with: makepkg produces a package file
and hands it to pacman, which is covered on
AUR helpers and makepkg.
Do not install after a bare refresh
Installing a package right after pacman -Sy gives you the new version of that package against the old versions of everything else. Run sudo pacman -Syu <package> instead, so the package arrives with the upgrade rather than ahead of it. See updating Arch Linux.
Common questions
How do I install a package with pacman?
Run sudo pacman -S followed by the package name. pacman resolves the dependencies, prints what it will install and the size of the download, and asks for confirmation before it does anything.
How do I install several packages at once?
List the names after -S, separated by spaces. Add --needed if some of them may already be installed and you do not want them reinstalled.
Where does pacman install packages to?
Wherever the package itself specifies, which for most software means below /usr. pacman does not choose a location: it extracts the package to the paths recorded in it, and pacman -Ql <package> lists every one of those paths.