How to fix "yay command not found" on Arch Linux

Endrit Qerreti

Endrit Qerreti

Are you getting the error "yay command not found" when trying to install a package on your system? This error means that yay is not installed on your system, or it could be corrupted and you can't use it to install anything.

On Arch Linux pacman is the default package manager that you can use to install and uninstall packages. However, pacman cannot download packages from the AUR repositories.

So to be able to install AUR packages one needs to have YAY installed on the system. Yay is a package manager like pacman, but the difference is that with yay you can dowload packages from the AUR repository, while with pacman you can download only from official repos.

In this tutorial, you will learn how to fix this error, and how to manage packages easily on your Arch Linux system.

Step 1 - Verify yay installation

To check if yay package manager is installed on your system, you can run the command below. If yay is installed, then this command will show us the version of yay, if yay is not installed then we'll get the error "yay command not found" as shown in the screenshot below

yay -v

Now that we know that yay is not installed on our system, we are going to install yay on the next step.

Step 2 - Install Yay

To install Yay on Arch Linux is easy, all you have to do is run the commands below one by one.

1) First install base-devel and git

pacman -S --needed git base-devel

Once you execute the command above, you will be asked to confirm if you want to proceed with the installation. Press Y to continue installing git and base-devel

2) Clone Yay github repository on your computer

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

3) cd into Yay

cd yay

4) Build Yay

makepkg -si

Once Yay has been installed, you will see the following output on your terminal.

Step 3 - Use Yay

Now that Yay is installed on your system, you can use it to update your system or install a package from the AUR repository.

For example, to update your system you can do

yay -Syu

Install a Package with Yay

To install an app on Arch linux using yay, you can do so by running

yay -S packagename

Replace packagename with the name of the app or package that you want to install

Search for a package with Yay

If you are unsure whether a package is available on the AUR repository, you can search for that package using the search function

yay search package-name

Alternatively, you can search for a package on the AUR's official website if you are not satisfied with the results you got from the terminal.

Simply navigate to the AUR's website, and on the search box enter the package name that you want to look for, and you will get all results based on your search.

AUR (en) - Home

Uninstall a Package with Yay

To uninstall a package from your system you can use the -R option.

yay -R package-name

Let's say you want to uninstall firefox-bin, then you can do so by running the command below

yay -R firefox-bin

Once you run the command above, you need to press Y to confirm the removal of the package.

Conclusion

By now you should know how to fix the error "yay command not found" and how to manage packages with Yay on Arch Linux.