Which AUR helper? Use Yay!

One of the strongest points of Arch Linux is the huge amount of packages available in the Arch User Repository (AUR). There are also many AUR helpers that make using the AUR really simple. In this post, you will learn how to install and use Yay, perhaps the best AUR helper.

Content

In Arch Linux, the AUR helpers are perhaps the most distinctive element of the distribution. Although they are not officially part of the distribution, they automate the installation of packages from the AUR (Arch User Repository). This makes unofficial applications like Spotify quite easy to install. AUR helpers enable searching, installing and removing packages from the AUR as if they were in the official repositories. Thus reducing manual compilation times that delay our productivity.

Perhaps the most popular AUR helpers have been Yaourt and Aurman, but they are currently discontinued and not recommended for use. But do not worry, Yay is here to save you.

Yay is probably the best AUR helper

Yay is an AUR helper written in the GO programming language. It is quite fast when searching for packages in the AUR repositories. Besides, it requires minimal dependencies. An almost distinctive element of Yay is that it allows autocompletion and colored output making it easier to read.

So, let us install it.

Install Yay in Arch Linux

First of all, to install Yay on Arch Linux, you need to have base-devel and git packages installed:

sudo pacman -S --needed base-devel git

When the installer asks you which packages to install, press the Enter key and install all the recommended dependencies.

Then, use git to download the source code of Yay:

git clone https://aur.archlinux.org/yay.git

Getting the Yay source code

I recommend running this command in a dedicated folder. For example, I created the folder ~/Programs and do the compilation and installation of the AUR programs from there. Also, if you are curious, I got this git link from Yay page in the AUR.

When you run the above command, a folder called yay will be created. Enter this folder using the cd command.

cd yay

In the yay folder, there is a file called PKGBUILD that contains all the installation instructions for yay. You can check its content:

less PKGBUILD

Note: to exit the less program, press the Q key

If everything is fine, start the compilation and installation:

makepkg -si

During the process you will have to enter the password:

Installing Yay

Hopefully, the compiling and installation will finish without errors and you will get Yay installed.

How to use Yay

Yay is very simple and easy to use. In many cases, the syntax is very similar to the Pacman syntax, so there is no need to learn new things.

Let us take a look.

Search for a package

Yay can search for a package in both standard and AUR repositories. To search for a package just use the following command:

yay -Ss package_name

For example, if I search for libreoffice, Yay gives the results for all available repositories including AUR, extra or community:

Search for a package using Yay

Search and Install a package

It is also simple and practical to use Yay for search and subsequent install of a package. For example, if you use the command yay followed by the package name without any option, it will show you all available packages and offer you an option to install it. As an example, I will use Spotify which is a very popular program that is not in the official Arch Linux repositories:

Install Spotify on Arch Linux using the Yay AUR helper

As you can see from the image, Yay searches for the spotify package. And if you choose the option 2, Yay will also compile and install it.

If you know the exact name of the package you want to install then you do not need to do a search first. In this case, Yay can install it with the same Pacman syntax:

yay -S package_name

Install a package using Yay without search

If the package has more than one supplier, you will be asked to choose one.

Upgrading all the installed packages with Yay

Finally, if you need to update all the packages including the AUR packages, you can use Yay for that. Again, it is the same syntax as in the Pacman:

yay -Suy

Upgrade all the installed package with Yay

Yay will install all the packages from the official repository as well as it will compile and install packages from the AUR which is a pretty good solution because you can update your whole system just with one command.

Remove a package

In case you want to uninstall an AUR package, you can do it the same way as with Pacman. That is, using the -R option. However, you can add the ns options to remove unnecessary dependencies as well:

yay -Rns package_name

Remove a package with Yay

You can also remove an installed AUR program and its dependencies with Pacman:

pacman -Rns package_name

Remove the orphaned packages with Yay

As you install and uninstall packages, it is possible that there will be some orphaned dependencies. You can search and remove them as follows:

yay -Yc

Removing the orphaned packages with Yay

This way you will be able to have your Arch Linux cleaner. To clean your system more, you can follow my guide on how to clean Arch Linux.

More information about Yay and AUR helpers

Yay has many more options than I have presented. If you want more information about Yay, you can get it from Yay man page:

man yay

Yay man page on the terminal

Also, you can visit the Yay GitHub page. I also wrote a post about how to install AUR packages manually, which is probably essential for every Arch Linux user.

Conclusion

Yay is a great AUR helper that stands out for being fast, flexible and having a syntax very similar to Pacman. I recommend using it because it is the most popular AUR helpers after Yaourt and Aurman are discontinued. Yay is also handy because you will be able to update all the packages installed in your system regardless of their source repository.

Average Linux User
Average Linux User I am the founder of the Average Linux User project, which is a hobby I work on at night. During the day I am a scientist who uses computers to analyze genetic data.