This comprehensive article shows how to use the yay command to easily install packages from AUR (Arch User Repository) in Arch Linux.
Arch Linux is an independently developed Linux distribution that strives to provide the latest stable versions of most software by following a rolling release model.
Due to its unlimited customization options and the complete control it gives users, Arch enjoys a vast user base and is one of the major desktop-oriented Linux distributions today.
Arch uses the Pacman package manager to install, update, and remove the software from its official repositories. Moreover, in addition to these repos, Arch Linux offers AUR, which is one of the most significant advantages of Arch Linux and makes the difference between Arch and the other Linux distros.
However, it can be confusing for new Arch users to understand why Arch has different software repositories, what they are, and what the differences are. So, before we go any further, let’s explain what an AUR repository is and what it gives us.
What Is the AUR Repo?
As previously said, Arch provides its users with official software repositories from which they can install apps and update software as needed. The Arch developers maintain these repositories, and the software in them is guaranteed to have passed bug and security testing before being made available to end users.
However, the amount of software available for Linux is limitless. Therefore, any Linux distrо can only house some of them in its repositories.
While having one of the largest and most software-rich repositories in the Linux world, the number of available software in Arch’s repositories is still limited. To address this limitation, Arch has developed the AUR repository.
AUR (Arch User Repository) is a software repository for Arch users maintained by Arch users. Its purpose is to house all of the software that has not found a home in the official Arch Linux repositories. It is a treasure trove of tens of thousands of software packages maintained by the Arch community, and you can find almost anything there.
Of course, the packages in AUR, which are maintained voluntarily by Arch users worldwide, cannot guarantee the same level of stability as those in official repositories.
However, this does not imply that the software is untrustworthy – quite the contrary. AUR has a system in place for users to vote on and report on the packages so that it may be resolved immediately if an issue emerges.
On top of that, the AUR voting system frequently results in packages with a high number of votes being included in the official Arch repository due to their widespread use and interest.
With that out of the way, let’s look at how you can easily use AUR and install packages from there using AUR helpers.
What is AUR Helper?
We’ll begin by stating two main approaches to installing AUR packages. The first is purely manual, involving the execution of several sequential commands to clone the corresponding package’s build files, build the package itself, and finally install it.
This method has two obvious drawbacks. First, it is more difficult to use for less experienced Arch users. Second, it lacks a mechanism to automatically update the package when an updated version is published to the AUR.
We stress that while Pacman may update all packages on your system that are installed from the official Arch repositories, it is not intended to interact with AUR. As a result, the well-known
pacman -Syu command will not provide you with an AUR package update.
This is when the AUR helpers come into play. The most simple way to think of them is as Pacman for AUR. In other words, these are small programs that are specifically designed to search for, install, or build AUR packages.
In addition, you may also use them to automatically update all of your AUR-installed packages, just like Pacman on your Arch Linux system.
It is crucial to highlight that the AUR helpers, like the AUR packages, are a result of the work of Arch users all around the world. In other words, Arch Linux developers do not support or develop them.
As a result, there are at least a dozen AUR helpers, with yay, pikaur, paru, pacaur, and others being the most popular and widely used by Arch users.
We’ll look at yay, one of the most popular AUR helpers, and how we can use it to install AUR packages on our Arch Linux system easily.
How to Use yay to Install AUR Packages
Yay (Yet Another Yogurt) is an AUR helper and Pacman wrapper written in Go programming language. First, however, we must install it on our Arch Linux system before using it. Here’s how.
Installing yay in Arch Linux
To begin, install some dependencies required for yay to function. To do this:
sudo pacman -S git base-devel
Then, clone, build locally, and install the yay package itself by running the three commands listed below in that order.
git clone https://aur.archlinux.org/yay-bin.git cd yay-bin makepkg -si
That’s all. The yay AUR helper should now be installed and ready to use on your Arch Linux system. You can check if everything is working correctly by running the command below, which will display the yay version.
Now that we have everything we need, let’s see how we can use yay to install packages directly from the AUR repository.
How to Install AUR Packages on Arch Linux Using yay
To install an AUR package, you must first know its exact name. For example, assume we want to install the popular GNOME extension Dash to Dock, which is not included in the official Arch repos but is available in AUR.
There are two approaches to identifying the correct package name. The first way is to use yay’s built-in search functionality by adding the ‘
-Ss‘ parameters to the command.
yay -Ss dash-to-dock
As you can see from the output, the package’s exact name is ‘
-Ss‘ option allows searching for a package on both the official Arch repositories and the AUR. However, if you want yay to search exclusively only among the packages in the AUR, execute the following command:
The package names in AUR may sometimes be confusing, especially for new Arch users. This is because of the AUR nature, allowing users to upload packages.
As a result, there is no unified concept of package names here, and it is possible to have the same package under many names simply because different users have uploaded their versions.
With that out of the way, let’s look at the second, far simpler approach for new Arch users to find packages in AUR – using a web browser.
Go to https://aur.archlinux.org/packages, type in the name of the package you’re looking for, then hit the ‘Go’ button. AUR will show all relevant matches in the package names.
Let me add that the ‘Votes’ and ‘Popularity’ columns give you a good indication of the package’s quality. In other words, the higher the numbers, the more users use that package and have confirmed its reliability.
Once we know the exact name of the package we want to install, we all have to pass to the yay command option ‘
-S‘ followed by the package’s name to be installed.
yay -S gnome-shell-extension-dash-to-dock
You will be prompted for several options, and my advice is to hit ‘Enter’ to accept all of the defaults. Then, Yay automatically will get the package dependencies needed to build the package, then build and install it.
Upgrading AUR Packages
One of the most valuable features of the yay AUR helper is the ability to update all packages installed on your system from the AUR repository if updates are available. To do this, type:
Print System Statistics
Another useful piece of information provided by the yay command is information on the packages installed on your system. Why is it so valuable?
If you install a large number of packages, the directory that keeps all cached AUR package builds, ‘
~/.cache/yay/,’ or those from the official repositories, ‘
/var/cache/pacman/,’ can grow dramatically. This way, you can see how much space it takes up at a look.
Remove Unnecessary Dependencies
The last option we will look at is cleaning your Arch Linux system of installed dependencies of packages that are no longer required. They take up a lot of space, so removing them is a good idea. Yay makes this simple with the command:
Furthermore, if you want to remove all unneeded package dependencies along with all cached packages, run:
In this article, we explained what the AUR repository is, what it is used for, and how to install packages from it using the yay AUR helper.
Now, you can pick any package from the tens of thousands of packages available in the AUR repository to further enrich the software on your Arch Linux system.
We hope we were of help. Any thoughts and suggestions are welcome in the comments section below.
Please, please, PLEASE, do not encourage inexperienced users to pass the -y flag to pacman without -u, or visa-versa (-Sy/-Su). This can result in incompatible package versions to be installed together, and potentially break the user’s system. Even if you are experienced, there is rarely reason not to use ‘pacman -Syu’ all together. In term of just installing packages, ‘pacman -S ‘ will often suffice.
Personally, I’ve never had such an issue (pacman -Sy), but I still find your remark relevant, and thank you for that. The appropriate changes have been made.