yay vs pacman: what an AUR helper actually is
yay is not a replacement for pacman. It is a wrapper: repository operations are handed straight to pacman, and what yay adds on top is the ability to build and install packages from the Arch User Repository, which pacman does not do.
yay -S <package>
What it does. Looks the same as pacman, but searches the AUR as well and builds from source when the package comes from there.
Watch out. An AUR package is a build script another user uploaded; nobody has reviewed it the way an official repository package is reviewed.
What the AUR is
The Arch User Repository is a collection of build scripts, called PKGBUILD files, that users upload. It distributes recipes for building packages, not built packages.
An AUR helper is a program that automates fetching a PKGBUILD, building it and handing the result to pacman, and that usually presents the whole thing behind pacman-like options.
That difference is the whole reason helpers exist. Installing from the official repositories means downloading a package that was already built and signed. Installing from the AUR means fetching a script, building the package on your own machine, and then installing the file that came out.
Which helper to pick is a smaller question than it looks, and the comparison page sets the two side by side.
Who does what
| Step | Handled by |
|---|---|
| Install from an official repository | pacman, whether you typed it or yay passed it along |
| Resolve and install dependencies from the repositories | pacman |
| Upgrade the system | pacman, for everything that came from a repository |
| Search the AUR | the helper |
| Fetch a PKGBUILD and show what changed in it | the helper |
| Build the package from source | makepkg, which the helper runs |
| Install the built file | pacman, through its -U operation |
| Check AUR packages for new versions | the helper; pacman does not know they exist |
Because the repository half is pacman either way, the commands look almost
identical. yay -Syu upgrades the repository packages exactly as
sudo pacman -Syu would, and then goes on to check the AUR packages,
which pacman -Qm lists.
One visible difference: sudo
Helpers are run as your normal user, not with sudo, and they call sudo themselves for the parts that need it. That is not a style preference: building a package as root runs whatever the PKGBUILD contains with full privileges.
An AUR PKGBUILD is a script that runs on your machine during the build. The check that exists is you reading it before building, which is why helpers offer to show it and why the show-me step is worth not skipping.
Do you still need pacman?
Yes, and you already are using it. The helper does not replace any of it: removals, queries and cache cleaning are pacman operations whether the helper types them for you or you do. Knowing the pacman command underneath is what lets you fix things when the helper is the part that is broken.
Common questions
What is yay?
yay is an AUR helper: a program that passes repository operations through to pacman and adds the ability to search the Arch User Repository, fetch a build script from it, build the package and install the result.
Is yay a replacement for pacman?
No. Everything yay does with the official repositories it does by calling pacman, and the package it builds from the AUR is installed by pacman as well. It adds a step pacman does not have rather than replacing what pacman does.
Do I still need to know pacman if I use yay?
Yes. Removals, queries and cache cleaning are pacman operations either way, and when a helper misbehaves the pacman command underneath is what you fall back to.