Arch Linux package manager (pacman) cheatsheet
Back to arch-linux.
I’m making this cheatsheet for myself. It’s in no way a replacement for the real documentation in the excellent Arch wiki:
Anyway, this is pretty much everything I use:
Command | What it does |
---|---|
|
Search for packages containing "tree" in the name or description. |
|
Install package "tree". |
|
Update all packages! |
|
Remove a package (the |
Updating all packages is, in theory, a scary thing to do. But I haven’t had any trouble with that since the old days. The official word about updating Arch is at:
Arch User Repository (AUR)
Like most distros, Arch has a community repository for packages outside the "official" packages.
You can’t search and install from the AUR with pacman, but you can manually download package builds and install them with pacman.
Or, you can use one of a number of third party applications to automate the process. I’ve had a good experience so far with:
$ paru -S <package from AUR>
Update: I ran into this issue libalpm.so.14 cannot be found… (github.com) with Paru and that pushed me to go back to revisit the manual process of installing things from the AUR, so…
Installing a package from the AUR
The AUR package process is actually quite similar to Slackware’s Slackbuilds.
Let’s use a real-world example I just performed: the minecraft-launcher package (aur.archlinux.org):
The package has a Git Clone URL, so grabbing a copy looks like this:
$ git clone https://aur.archlinux.org/minecraft-launcher.git
Creating the package and installing it looks like this (note that the
minecraft-launcher
directory was created as a result of the Git clone command
above):
$ cd minecraft-launcher $ makepkg $ sudo pacman -U minecraft-launcher*.pkg.tar.zst
So the general form of the whole thing is:
$ git clone https://aur.archlinux.org/<PACKAGE>.git $ cd <PACKAGE> $ makepkg $ sudo pacman -U <PACKAGE>.pkg.tar.zst
AUR dependencies
Uh oh! Some AUR packages will have dependencies:
==> ERROR: 'pacman' failed to install missing dependencies. ==> Missing dependencies: <...list...>
In addition to the list returned by makepkg, the AUR page for the package will list the dependencies as well.
You can tell makepkg to resolve dependencies with the -s
option:
$ makepkg -s
Ah, but this can only automatically resolve dependencies that are in the Arch Linux official repositories (not AUR).
So if any of your AUR package’s dependencies are also AUR packages, you’ll need to install those first.
The AUR website page for a package shows its list of dependencies and will include a little "AUR" annotation next to any that are also AUR packages.
A package like, say, renpy
, has a fair number of recursive AUR dependencies
and it gets real tedious real fast.
In cases like that, I say there is no shame in just downloading the pre-built
binary package from the project’s website.
My way of listing packages installed
This may look pretty dumb, but I actually like getting my installed packages
list by searching my Bash history. (Note that ag
is The Silver Searcher - see
Software I Use.)
When I was root:
# history | ag -Q 'pacman -S ' 11 pacman -S grub 14 pacman -S efibootmgr 30 pacman -S xorg 31 pacman -S xf86-video-amdgpu mesa vulkan-radeon 32 pacman -S xfce4 lxdm 41 pacman -S firefox 51 pacman -S steam 52 pacman -S ttf-liberation 53 pacman -S lib32-systemd 60 pacman -S alsa-utils 90 pacman -S stow 91 pacman -S git 92 pacman -S ruby 96 pacman -S sudo
As my regular user:
$ history | ag -Q 'pacman -S ' 102 sudo pacman -S thunderbird 127 sudo pacman -S krita 128 sudo pacman -S inkscape 145 sudo pacman -S tree 229 sudo pacman -S the_silver_searcher
Update: I’ve also installed since the above:
-
tmux
The reason I like this method is that it shows package groups
like xorg
the way I installed them, not as a couple dozen
xorg-*
entries.
It also shows the order in which I installed things (along with the mistakes and typos I made…which I’ve trimmed from the above example output!)