Home·Terminal commands

pacman -S

Packages and runtimes

Usage

sudo pacman -S [--needed] <package>

Installs a package from the sync repositories on Arch; because the distribution rolls, refreshing with -Sy and installing without upgrading creates a partial upgrade that breaks libraries, so use -Syu.

Common flags

FlagMeaning
-Syurefresh and upgrade the whole system, the supported way to update
--neededdo not reinstall packages already at that version
--noconfirmno prompts, for scripts
-Ss <pattern>search the repositories
-R <package>remove a package
-Qi <package>show what is installed and why

Examples

sudo pacman -S ripgrep

installs from the sync repositories

sudo pacman -Syu

the full upgrade Arch expects you to run

sudo pacman -S --needed base-devel

installs the group, skipping what is there

The question is always what goes where: inside this project, or on the whole machine.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does pacman -S do?

Installs a package from the sync repositories on Arch; because the distribution rolls, refreshing with -Sy and installing without upgrading creates a partial upgrade that breaks libraries, so use -Syu.

Q. How do I type it?

sudo pacman -S [--needed] <package> — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

6 are listed here; the full set is in man pacman. This command sits under Packages and runtimes.

Related commands

man page: man pacman--S