How to Install AUR Packages via Yay on Arch Linux

  3 mins read  

How to Install AUR Packages via Yay on Arch Linux

There are several packages that are not yet in the official Arch Linux repository and one of the processes for a package to be official is first to be part of the AUR.

The Arch User Repository (AUR) is a community-driven repository for Arch users.

Packages are “formulated” by a file named PKGBUILS and you compile with the makepkg command.

How do you install AUR?

First of all you need to have the construction tools, and to do this install the base-devel package if you haven’t installed it:

sudo pacman -S --needed base-devel

The --needed option is to ignore packages that you already have installed, instead of reinstalling them.

Then just

  • Clone with Git the repository at the address of the AUR packages, use the search field to find the name of the package you want.
  • Enter the repository and run the makepkg -si command
    • The -s option, automatically resolves and installs any dependencies with pacman before compiling, it uses pacman for this.
    • The -i option installs the package if it was compiled successfully.

Example of a fictitious terminalroot package, I searched the Package search field and clicked and was directed to its page: https://aur.archlinux.org/packages/terminalroot

git clone https://aur.archlinux.org/terminalroot.git
cd terminalroot/
makepkg -si

Saving time with Yay

Well, cloning and compiling is enough to think: Wasn’t it better to automate this process? !! Yes it is. And they already thought about it and created Yay.

I think Yay should already be part of the official repository and we can install it via pacman, but still (at least until the date of publication of this article) they haven’t done that.

So you need to install it via AUR and then use it to install any other AUR package, weird, but that’s the way it is! To install Yay, run:

git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

Remembering that you need base-devel as informed above. During installation it will ask for your sudo password to copy the binary to a system path that is in the $PATH variable.

From then on everything is easier! 🍺

To install anything, just run the yay command with the -S parameter similar to pacman and enter the package name.

Remembering that it has auto-complete, therefore, it is easier to identify if the package exists only by pressing TAB when typing the first letters of the name, reducing the need to go to the AUR address. Cool, right ?!

Example again with the fictional terminalroot package

yay -S terminalroot

Only that! Ah, don’t use sudo !!! He will refuse, he will ask you for the password during the installation, of course, it’s the AUR process! 😃

Alright?! Well, that’s it for today. If you want to go even deeper, I suggest the links below:

Add our feed: https://en.terminalroot.com.br/feed to:

Feedly