How to Install and Use Yay on Arch Linux and Manjaro

Linux TLDR
Last Updated:
Reading time: 4 minutes
πŸš€
Quick Overview

Instantly, install Yay via the following pacman or pamac commands.

$ sudo pacman -S yay

#OR

$ sudo pamac install yay

However, I advise you to read the entire article in order to gain a deeper understanding, which includes valuable tips on handling packages from AUR using Yay.

Yay (Yet Another Yaourt) is a popular Arch User Repository (AUR) helper for Arch Linux and its derivatives, such as Manjaro, after the discontinuation of Yaourt and Packer.

It is a command-line utility that simplifies the process of searching, installing, and managing packages from both the official repositories and the AUR.

What is the Arch User Repository (AUR)?

If you don’t know about AUR, In a nutshell, it’s a community-driven repository that contains user-contributed package build scripts. This script allows users to install packages that are not available in the official Arch repositories.

In this article, you will learn how to install Yay on your Arch-based systems, how to use it (with practical examples), and when not to use it.

Tutorial Details

DescriptionYay (AUR Helper)
Difficulty LevelModerate
Root or Sudo PrivilegesYes
OS CompatibilityArch, Manjaro, EndeavourOS, etc.
Prerequisites–
Internet RequiredYes

How to Install Yay (AUR Helper) on Arch-Based Systems

Here are the steps to install Yay (the AUR helper) on your Arch-based systems:

1. Open your terminal, refresh the package cache, and update the system by using the pacman command:

$ sudo pacman -Syu

2. Install β€œgit” (required to clone the Yay git repository) and β€œbase-devel” (install essential development tools and libraries for building AUR packages).

$ sudo pacman -S --needed git base-devel

When using the β€œ--needed” flag, it won’t reinstall packages that are already installed.

3. Now, use the git command to clone the Yay repository from the AUR in your current directory:

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

4. Once done, switch to the cloned Yay directory using the cd command:

$ cd yay

5. Lastly, build and install Yay using the β€œmakepkg” utility.

$ makepkg -si

The β€œ-s” flag is used to automatically resolve and install required Yay dependencies, and the β€œ-i” flag is used to install the package once it’s built.

6. After the installation is successfully completed, you can delete the Yay directory using the following command:

$ cd .. && rm -rf yay

7. Ensure the β€œyay” command is accessible from the terminal by checking its version information using the following command:

$ yay --version

Output:

Verifying the Yay installation

How to Use Yay in Arch Linux and Manjaro

Once Yay is installed, you can simplify the process of searching, installing, and managing the packages from the AUR repositories. Here are some examples of how to use β€œyayβ€œ:

Update System and Packages

When you issue the β€œyay” command without specifying any flags, it will automatically consider using the β€œyay -Syu” command used to update your Arch Linux system. It’s also equivalent to the β€œpacman -Syu” command:

$ yay

#OR

$ yay -Syu

After issuing the above command, it will update the system’s package database and upgrade the installed packages.

Update AUR Packages Only

The previously mentioned command will also upgrade the packages installed by Pacman and Yay. If you only want to upgrade packages installed from Yay, run:

$ yay -Sua

Check for Updates

To check for available updates for all installed packages from the β€œyay” command without upgrading them, you can use the following command:

$ yay -Qua

Or use the β€œyay -Qu” command to include the pending package update information installed from official repositories.

Search for a Package

To search for a package in the official repositories or AUR repository, you can use the β€œyay” command followed by the package name (e.g., β€œfirefoxβ€œ):

πŸ“
When you run the β€œyay firefox” command, it will list the matched packages and allow you to select packages to install.
$ yay firefox

#OR

$ yay -Ss firefox

Install a Package

To install a package from the official repositories or AUR repository, you can use the β€œyay” command with the β€œ-S” flag followed by the package name (e.g., β€œneofetchβ€œ):

$ yay -S neofetch

Print Package Information

To print the installed or uninstalled package information from the official repositories or AUR, you can use the β€œyay” command with the β€œ-Si” flag followed by the package name (e.g., β€œneofetchβ€œ):

$ yay -Si neofetch

Remove a Package

To remove a package, you can use the β€œ-R” flag with the β€œyay” command followed by the installed package name (e.g., β€œneofetchβ€œ):

$ yay -R neofetch

Clean Package Cache

To clean the package cache and remove the old, unwanted dependencies and leftover packages, run:

$ yay -Sc

Print the System Statistics

To check the list of total installed packages, including foreign and explicitly installed packages, the total size occupied by the installed packages, and the total size of the Pacman and Yay caches, run:

$ yay -Ps

When Not to Use Yay or AUR Packages

AUR packages are entirely user-contributed, and while many maintainers are careful, some packages might not be thoroughly reviewed for security issues. Before installing any package from the AUR, you should review the PKGBUILD file (the build script for the package) and inspect the code to ensure its safety.

And most of the packages can be updated frequently, but not all maintainers follow the same update standards as the official repositories. So, installing updates from the AUR might introduce instability or compatibility issues with other system packages. It’s a good practice to be cautious and only update AUR packages when necessary.

If you have multiple AUR helpers installed on your system, then they might conflict while installing and managing the packages. So, stick to using a single AUR helper to avoid potential issues.

While using AUR helpers like β€œyay” can automate certain tasks,Β it might also take away some of the details of package management. If you want more control over the installation process or want to be directly involved in package building, you can choose to manually install AUR packages.

How to Remove Yay (AUR Helper) from Arch-Based Systems

If you do not want to have Yay any more for any reason, you can use the following command to remove it from your Arch-based systems:

$ sudo pacman -Rs yay
What Happens to Packages Installed from AUR Repositories Using Yay?

Yay is just a helper to automate the process of downloading, building, and installing packages from the AUR. If you remove β€œyay” from your system, the packages that were installed from AUR repositories using β€œyay” will remain on your system.

So, if you remove β€œyayβ€œ, the packages it installed will stay on your system until you explicitly uninstall them using the Pacman package manager. To remove an AUR package without β€œyayβ€œ, use β€œpacman -Rs” followed by the package name.

Final Word

I hope you find this article useful. If you have any questions or queries related to this article, then feel free to ask them in the comment section.

Till then, peace!

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.