pacman the package management system

A simple library-based package manager.


In the October meeting, we discussed some of the most popular usages of
pacman and pkgfile, I intend to go into a bit more detail in this document.



pacman is a utility which manages software packages in Linux. It uses simple compressed files as a package format, and maintains a text-based package database (more of a hierarchy), just in case some hand tweaking is necessary.

pacman does not strive to "do everything." It will add, remove and upgrade packages in the system, and it will allow you to query the package database for installed packages, files and owners. It also attempts to handle dependencies automatically and can download packages from a remote server.


Version 2.0 of pacman introduced the ability to sync packages (the --sync option) with a master server through the use of package databases. Prior to this, packages would have to be installed manually using the --add and --upgrade operations.

Version 3.0 was the switch to a two-part pacman?—?a back-end named libalpm (library for Arch Linux Package Management) and the familiar pacman front-end. Speed in many cases was improved, along with dependency and conflict resolution being able to handle a much wider variety of cases. The switch to a library-based program should also make it easier in the future to develop alternative front ends.

Version 4.0 added package signing and verification capabilities to the entire makepkg/repo-add/pacman toolchain via GnuPG and GPGME.

Version 5.0 added support for pre/post-transaction hooks and sync database file list operations.

[From the manfile]:


Pacman is a package management utility that tracks installed packages

on a Linux system. It features dependency support, package groups,

install and uninstall scripts, and the ability to sync your local

machine with a remote repository to automatically upgrade packages.

Pacman packages are a zipped tar format.


Since version 3.0.0, pacman has been the front-end to libalpm(3), the

“Arch Linux Package Management” library. This library allows

alternative front-ends to be written (for instance, a GUI front-end).


Invoking pacman involves specifying an operation with any potential

options and targets to operate on. A target is usually a package name,

file name, URL, or a search string. Targets can be provided as command

line arguments. Additionally, if stdin is not from a terminal and a

single hyphen (-) is passed as an argument, targets will be read from



The popular commands we discussed in the meeting:

for pacman

pacman -Syu #to update the entire system, (all packages)


-S, --sync

Synchronize packages. Packages are installed directly from the

remote repositories, including all dependencies required to run the

packages. For example, pacman -S qt will download and install qt

and all the packages it depends on. If a package name exists in

more than one repository, the repository can be explicitly

specified to clarify the package to install: pacman -S testing/qt.

You can also specify version requirements: pacman -S "bash>=3.2".

Quotes are needed, otherwise the shell interprets ">" as

redirection to a file.


In addition to packages, groups can be specified as well. For

example, if gnome is a defined package group, then pacman -S gnome

will provide a prompt allowing you to select which packages to

install from a numbered list. The package selection is specified

using a space- and/or comma-separated list of package numbers.

Sequential packages may be selected by specifying the first and

last package numbers separated by a hyphen (-). Excluding packages

is achieved by prefixing a number or range of numbers with a caret



Packages that provide other packages are also handled. For example,

pacman -S foo will first look for a foo package. If foo is not

found, packages that provide the same functionality as foo will be

searched for. If any package is found, it will be installed. A

selection prompt is provided if multiple packages providing foo are



You can also use pacman -Su to upgrade all packages that are

out-of-date. See Sync Options below. When upgrading, pacman

performs version comparison to determine which packages need

upgrading. This behavior operates as follows:



1.0a < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0 < 1.0.a < 1.0.1


1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0


Additionally, version strings can have an epoch value defined that

will overrule any version comparison, unless the epoch values are

equal. This is specified in an epoch:version-rel format. For

example, 2:1.0-1 is always greater than 1:3.6-1.


-y, --refresh

Download a fresh copy of the master package database from the

server(s) defined in pacman.conf(5). This should typically be used

each time you use --sysupgrade or -u. Passing two --refresh or -y

flags will force a refresh of all package databases, even if they

appear to be up-to-date.


-u, --sysupgrade

Upgrades all packages that are out-of-date. Each

currently-installed package will be examined and upgraded if a

newer package exists. A report of all packages to upgrade will be

presented, and the operation will not proceed without user

confirmation. Dependencies are automatically resolved at this level

and will be installed/upgraded if necessary.


Pass this option twice to enable package downgrades; in this case,

pacman will select sync packages whose versions do not match with

the local versions. This can be useful when the user switches from

a testing repository to a stable one.


Additional targets can also be specified manually, so that -Su foo

will do a system upgrade and install/upgrade the "foo" package in

the same operation.

pacman -S # To install packages (listed packages or suites of packages)

(package names separated by spaces) … but you can also

use -Syu to install package(s) and upgrade everything as



pacman -U # To install from file. (You can cd to directory with downloaded

and use this command to install the package)


-U, --upgrade

Upgrade or add package(s) to the system and install the required

dependencies from sync repositories. Either a URL or file path can

be specified. This is a “remove-then-add” process. See Upgrade

Options below; also see Handling Config Files for an explanation on

how pacman takes care of configuration files.


pacman -Ss # To search for a package


-s, --search <regexp>

Search each locally-installed package for names or descriptions

that match regexp. When including multiple search terms, only

packages with descriptions matching ALL of those terms are




pkgfile searches the .files metadata created by repo-add(8) to retrieve

file information about packages. By default, the provided target is

considered to be a filename and pkgfile will return the package(s)

which contain this file. The repos which pkgfile searches is determined

by those enabled in /etc/pacman.conf.


The popular usages of pkgfile:

pkgfile <file-name-here> # Search for a command or package that may be part of a package a suite of packages, (such as ifconfig)


$ pkgfile ifconfig


$ pkgfile iwconfig


$ pkgfile convert


Of course, if the command is the same name of one single package, here is what you get:

$ pkgfile nmap


There are several man pages available for the programs, utilities, and configuration files dealing with pacman.

Although the package manager itself is quite simple, many scripts have been developed that help automate building and installing packages. These are used extensively in Arch Linux. Most of these utilities are available in the Arch Linux projects code browser.

Other Utilities

Utilities available:

  • abs - ABS (Arch Build System), scripts to download & use the Arch Linux PKGBUILD tree

  • dbscripts - scripts used by Arch Linux to manage the main package repositories

  • devtools - tools to assist in packaging and dependency checking

  • namcap - a package analysis utility written in python

srcpac - a bash build-from-source pacman wrapper



Here is a list of Linux Distributions that use pacman as their package
management system:



Arch Linux




BlackArch Linux

Chakra (operating system)

DeLi Linux

Frugalware Linux

Manjaro Linux

Parabola GNU/Linux-libre

Mailing Lists
There is a mailing list devoted to pacman development, hosted by Arch Linux. Subscribe or view the archives.