Home Arch User Repository (AUR) How To Install Yay AUR Helper In Arch Linux, EndeavourOS, Manjaro Linux

How To Install Yay AUR Helper In Arch Linux, EndeavourOS, Manjaro Linux

Install AUR Packages Using Yay In Arch Linux

By sk
Published: Last Updated on 15.7K views

As you may already know, AUR (Arch User Repository) is the community-driven, largest third-party software repository. AUR hosts tens of thousands of user-generated packages for Arch-based systems. In this guide, we will learn what is Yay, how to install Yay AUR helper in Arch Linux, EndeavourOS, and Manjaro Linux, and finally how to use Yay to install packages from AUR.

What is Yay?

Yay, stands for yet another yaourt, is a reliable AUR helper program written in GO language. It provides an interface for pacman and also it has almost no dependencies.

Yay is a wrapper for pacman that is meant to be used for better integration with the AUR. In short, Yay automates installing AUR packages so the process is similar to installing normal arch packages. Yay is still able to update and download normal repository packages.

It provides Yaourt like search feature and minimizes the user input greatly. Another notable feature is you can choose which application to install or update. It also supports AUR tab completion, so just type few letters of an AUR package and hit enter KEY to complete the name.

Yay Features

Concerning about Yay features, we can list the following:

  • Advanced dependency solving
  • PKGBUILD downloading from ABS or AUR
  • Completions for AUR packages
  • Query user up-front for all input (prior to starting builds)
  • Narrow search (For instance, when you enter yay linux header, it will first search linux and then narrow on header)
  • Find matching package providers during search and allow selection
  • Remove make dependencies at the end of the build process
  • Vote/Unvote for packages

In the past, I was using Pacaur for installing AUR packages. It did a great job and I really liked it. I have also used some other AUR helpers such as Packer and Yaourt as well. But, they are all now discontinued and not recommended to use anymore. After reading the features of Yay, I thought to give "Yay" a try and see how it works. Let us get started!

Install Yay AUR Helper in Arch Linux, EndeavourOS, Manjaro Linux

If you already have installed any AUR helpers, you can install Yay using any one of the AUR helper program. For instance, you can install yay using Paru AUR helper like below:

$ paru -S yay

If it is a Fresh Arch install, you can install Yay by cloning the PKGBUILD and building with makepkg:

$ sudo pacman -S --needed git base-devel
$ git clone https://aur.archlinux.org/yay.git
$ cd yay
$ makepkg -si

Install Packages from AUR using Yay

Let us see a few command examples to install and manage packages from AUR using yay helper program.

1. Update Arch Linux

When you enter yay without any options, it will automatically add the -Syu flags and update your Arch Linux system. This is equivalent to pacman -Syu command.

$ yay

This command will update package list and upgrade all currently installed packages from the official repo and AUR.

2. Update AUR Packages only

The yay or yay -Syu command will upgrade all currently installed repo and AUR packages. If you want to upgrade only the AUR packages, run:

$ yay -Sua

To update a specific package, for example nano, run:

$ yay -U nano

3. Print available AUR updates

If you want to display all available AUR updates, but don't want to install them, use -Qua flags:

$ yay -Qua

4. Install a specific package

To install a specific package, for example nano, with Yay, run:

$ yay -S nano

This installs Nano text editor along with the required dependencies.

5. Search packages

To search for a specific package (E.g. nano) on the repos and the AUR, run:

$ yay -Ss nano

This will display all packages that contains "nano" in their name.

6. Display package-installation selection menu

One of the good feature of Yay is if you pass this command with no operation, then it will display menu for package install selection. In other words, Yay will allow you to interactively search for a package, choose a package from the list and install it.

For instance, when I run the following command (Note that there is no operation specified), it shows me the menu for package selection.

$ yay vlc

This command will search and list all packages that contains the word "vlc" in their name or description.

Display Package-installation Selection Menu
Display Package-installation Selection Menu

Simply type a prefix number to install the respective package. You can also specify multiple numbers with space-separated to install multiple packages.

7. Install Packages without User Confirmation

To install any packages without confirmations (without user interventions, of course), use "--noconfirm" option.

$ yay -S --noconfirm <package-name>

8. Remove Packages

To uninstall a package using Yay, use -R flag:

$ yay -R nano

We can also uninstall multiple packages by mentioning space-separated like below:

$ yay -R pkg1 pkg 2

9. Remove Cache

To remove unwanted dependencies and leftover packages, use -c, or --clean flags:

$ yay -c

Sample Output:

checking dependencies...

Packages (1) go-2:1.20.1-1

Total Removed Size:  195.64 MiB

:: Do you want to remove these packages? [Y/n] y
:: Processing package changes...
(1/1) removing go                                                                       [###################################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...

If you want to clean cached AUR packages and any untracked files in the cache, run:

$ yay -Sc

You will be asked a few questions. Read them and answer accordingly to remove cached packages.

Packages to keep:
  All locally installed packages

Cache directory: /var/cache/pacman/pkg/
:: Do you want to remove all other packages from cache? [Y/n] y
removing old packages from cache...

Database directory: /var/lib/pacman/
:: Do you want to remove unused repositories? [Y/n] y
removing unused sync repositories...

Build directory: /home/ostechnix/.cache/yay
:: Do you want to remove all other AUR packages from cache? [Y/n] y
removing AUR packages from cache...
:: Do you want to remove ALL untracked AUR files? [Y/n] y
removing untracked AUR files from cache...
Remove Package Cache using Yay
Remove Package Cache using Yay

10. Remove Unneeded Dependencies

To remove unwanted dependencies, use -Yc flag as shown below.

$ yay -Yc

11. Print Package Updates

To print the list of packages that needs to be updated, run:

$ yay -Pu

Sample output:

pywebkitgtk 1.1.8-3 -> 1.1.8-5
webkitgtk2 2.4.11-6 -> 2.4.11-12

12. Print Package Information

To display information about a package from the repos or the AUR, run:

$ yay -Si nano
Print Package Information
Print Package Information

13. Print System Statistics

To show the statistics for installed packages and system health, run:

$ yay -Ps

This command will list the total installed packages, foreign and explicitly installed packages, total size occupied by the installed packages, total size of the pacman cache and yay cache.

Print System Statistics
Print System Statistics

14. Download PKGBUILD

We can download the PKGBUILD and related files of the given package (E.g. nano) using Yay like below:

$ yay -G nano

This will download the PKGBUILD and related files of Vim package in a folder called nano in the current directory.

$ ls nano/
repos  trunk

15. Print PKGBUILD

If you do not want to download the PKGBUILD, but only print the PKGBUILD of the given package, run:

$ yay -Gp nano
Print PKGBUILD
Print PKGBUILD

PKGBUILDs are just shell script functions. Since the Packages from the AUR are user-made and therefore have the possibility of being malicious. You can inspect the pkgbuilds to make sure they're not malicious.

16. Build and install a PKGBUILD

Go to the directory where you've saved the PKGBUILD and run the following command to build and install a PKGBUILD in the current directory:

$ yay -Ui

17. Generate Package Development Database

To generate development package database used for devel update, run:

$ yay -Y --gendb

Sample Output:

:: Querying AUR...
:: (1/1) Downloaded PKGBUILD: yay
:: (1/1) Parsing SRCINFO: yay
:: GenDB finished. No packages were installed

18. Enable color in Yay Output

Yay only enables color in the output if color is enabled in pacman.

To Enable color in your pacman.conf, open it using any text editor:

$ sudo nano /etc/pacman.conf

Under the Misc Options section, you will see a word named Color. Simply uncomment it by removing the # symbol:

Enable Color in Pacman Configuration File
Enable Color in Pacman Configuration File

Press CTRL+O followed by CTRL+X to save the file and close it.

You can also uncomment the "ParallelDownloads" line if you want to enable parallel downloading in pacman.

19. Print News from Archlinux Homepage

To display the latest news from the Arch Linux homepage, run:

$ yay -Pw

If you want to only show titles when printing news, use -q flag:

$ yay -Pq

20. Display Help

To view Yay general options and usage, refer its help section by running the following command:

$ yay --help

You can also refer Yay manual pages for detailed help:

$ man yay

Update: A new AUR helper named Paru is released by the co-developer of Yay. Check out the following link for more details on Paru AUR helper.

Are AUR Packages Safe?

YES and NO. AUR packages are user produced content. Any use of the provided files is at your own risk.

AUR packages can be safe, only if you've examined them, and know what they do. Even though, AUR has a voting system, they are not always safe. What goes into the package is entirely up to its maintainer. So I highly recommend you to read the PKGBUILD before installing.

PKGBUILDs are just shell script functions plus some variables. The PKGBUILD setup is fairly simple, but you do need to have a basic understanding of the overall Linux userspace in order to vet the contents.

To make sure if a PKGBUILD is safe, double check that the URL points to the real upstream for the software. Make sure it's not adding anything strange, and check that the scripts are all focused on compiling/running tests on the software.

As far as I know, Malicious content in AUR is very rare. But always verify PKGBUILDs.

Conclusion

In this guide, we discussed how to install Yay in Arch Linux and how to install and manage AUR packages using Yay with examples.

AUR comes handy if a package is not available in the official repositories. Thanks to AUR helpers like Yay, the process of installing packages from AUR in Arch Linux and its variants is quite easy.

Resource:

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More