How to Install yay on Arch Linux

yay (Yet Another Yogurt) is an AUR helper that simplifies installing, updating, and managing packages from both the official Arch repositories and the Arch User Repository (AUR). Instead of manually cloning PKGBUILDs, resolving dependencies, and running makepkg, yay handles the entire process with familiar pacman-style syntax. By the end of this guide, you will have yay installed and configured to search, install, and update AUR packages alongside your regular system packages.

This guide covers installing yay using two methods: the pre-compiled binary for a quick setup, or compiling from source if you prefer building locally. Both methods produce identical functionality. You will also learn essential yay commands for searching packages, performing system updates, cleaning caches, and troubleshooting common issues. If you need to configure sudo access on Arch Linux, complete that first since building AUR packages requires privilege escalation.

Understanding the AUR and AUR Helpers

The Arch User Repository (AUR) is a community-driven repository containing package descriptions (PKGBUILDs) that allow you to compile and install software not available in the official repositories. The AUR hosts thousands of packages including proprietary applications, development versions, and niche tools.

Without an AUR helper, installing AUR packages requires manually cloning the PKGBUILD repository, reviewing the build script, installing dependencies, running makepkg, and then installing the resulting package with pacman -U. AUR helpers like yay automate this workflow while still allowing you to review PKGBUILDs before building. If you prefer a Rust-based alternative, see our guide to install Paru on Arch Linux.

yay specifically offers several advantages over manual AUR management:

  • Unified package management: Search and install from both official repositories and AUR with a single command
  • Dependency resolution: Automatically handles AUR packages that depend on other AUR packages
  • Batch operations: Prompts for all user input upfront, then completes the entire build process without interruption
  • pacman compatibility: Uses the same flags and syntax as pacman, reducing the learning curve

AUR helpers are community tools and are not officially supported by Arch Linux. The Arch Wiki recommends understanding manual AUR package installation before using helpers. Always review PKGBUILDs before building, as AUR packages are user-submitted and not verified by Arch developers.

Install Prerequisites

Building AUR packages requires development tools and version control software. The base-devel meta-package provides compilers, make, and other build essentials, while git is needed to clone package repositories from the AUR.

Update System First

Synchronize the package database and upgrade existing packages before installing new software:

sudo pacman -Syu

Running a full system upgrade prevents dependency conflicts that can occur when mixing packages from different repository states.

Install Build Dependencies

Install the required packages for building AUR software:

sudo pacman -S --needed git base-devel

The --needed flag skips packages that are already installed at the current version, avoiding unnecessary reinstallation.

Choose an Installation Method

yay is available from the AUR in two variants. Both provide identical functionality once installed, so your choice depends on installation speed versus build verification preferences.

MethodChannelVersionUpdatesBest For
yay-bin (Recommended)AURLatest stableManual via yay -SyuMost users who want quick installation
yay (source)AURLatest stableManual via yay -SyuUsers who prefer compiling locally or need non-x86_64 builds

For most users, yay-bin is recommended because it installs in seconds without requiring the Go compiler. The pre-compiled binary comes directly from the official yay GitHub releases. Only compile from source if you specifically need to verify the build process yourself or if pre-compiled binaries are unavailable for your CPU architecture (such as ARM devices).

Option 1: Install yay Binary (Recommended)

The binary package downloads a pre-compiled yay release from GitHub and packages it for installation. This method completes in seconds and does not require the Go compiler.

Clone the yay-bin Repository

Clone the AUR package repository to your home directory:

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

Review the PKGBUILD (Recommended)

Before building any AUR package, review the PKGBUILD to verify what the package does. This step is recommended because AUR packages are user-submitted and not vetted by Arch developers:

cat PKGBUILD

Look for suspicious commands, unexpected URLs, or scripts that run with elevated privileges. The yay-bin PKGBUILD should simply download the official release tarball from GitHub and install the binary.

Build and Install the Package

Build the package and install it with a single command:

makepkg -si

The flags mean: -s installs missing dependencies automatically, and -i installs the package after building. You will be prompted for your sudo password to complete the installation.

Expected output during installation:

==> Making package: yay-bin 12.5.7-1 (Sun Jan 25 08:54:03 2026)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading yay_12.5.7_x86_64.tar.gz...
==> Validating source_x86_64 files with sha256sums...
    yay_12.5.7_x86_64.tar.gz ... Passed
==> Extracting sources...
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
==> Creating package "yay-bin"...
==> Leaving fakeroot environment.
==> Finished making: yay-bin 12.5.7-1

Clean Up Build Directory

After successful installation, remove the cloned repository:

cd ~
rm -rf yay-bin

Option 2: Compile yay from Source

Compiling from source requires the Go programming language, which is installed automatically as a build dependency. This method takes longer but produces a locally-compiled binary.

Clone the yay Repository

Clone the source package repository:

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

Build and Install

Build yay from source and install:

makepkg -si

The build process downloads Go modules, compiles the yay binary, generates translations, and creates the package. This typically takes 20-60 seconds depending on your system.

==> Making package: yay 12.5.7-1 (Sun Jan 25 08:54:35 2026)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Installing missing dependencies...
:: Proceed with installation? [Y/n]
==> Retrieving sources...
  -> Downloading yay-12.5.7.tar.gz...
==> Validating source files with sha256sums...
    yay-12.5.7.tar.gz ... Passed
==> Starting build()...
go build -trimpath -mod=readonly -modcacherw -ldflags '...' -buildmode=pie -o yay
==> Entering fakeroot environment...
==> Starting package()...
==> Finished making: yay 12.5.7-1

Clean Up Build Directory

Remove the cloned repository after installation:

cd ~
rm -rf yay

Verify Installation

Confirm yay is installed correctly by checking the version:

yay --version

Expected output:

yay v12.5.7 - libalpm v16.0.1

The version numbers reflect your installed yay release and the pacman library version.

Basic yay Usage

yay uses pacman-compatible syntax, so most commands work identically. The key difference is that yay searches both official repositories and the AUR simultaneously.

Search for Packages

Search for packages across repositories and AUR:

yay package-name

Running yay with just a package name performs an interactive search. Results display package names, versions, descriptions, and vote counts. Enter the number next to a package to install it.

For a non-interactive search that only displays results:

yay -Ss package-name

Install Packages

Install a package from the official repositories or AUR:

yay -S package-name

yay automatically determines whether the package is in the official repositories or AUR and handles it appropriately. For AUR packages, yay clones the PKGBUILD, prompts you to review it, resolves dependencies, builds the package, and installs it.

Update All Packages

Perform a full system upgrade including AUR packages:

yay -Syu

This synchronizes the package database, upgrades official packages, checks for AUR updates, and rebuilds any outdated AUR packages. Running yay without any arguments performs the same operation.

View Package Information

Display detailed information about a package:

yay -Si package-name

For AUR packages, this shows the maintainer, votes, popularity, dependencies, and last update date.

Remove Packages

Remove a package and its dependencies that are no longer required:

yay -Rns package-name

The flags remove the package (-R), delete its configuration files (-n), and remove orphaned dependencies (-s).

View System Statistics

Display package statistics and cache sizes:

yay -Ps

Example output:

==> Yay version v12.5.7
===========================================
==> Total installed packages: 156
==> Foreign installed packages: 2
==> Explicitly installed packages: 5
==> Total Size occupied by packages: 1.0 GiB
==> Size of pacman cache /var/cache/pacman/pkg/: 207.6 MiB
==> Size of yay cache /home/username/.cache/yay: 4.0 KiB
===========================================
==> Ten biggest packages:
gcc: 208.8 MiB
perl: 69.9 MiB
...

“Foreign installed packages” refers to packages not found in the official repositories, which includes AUR packages.

Clean Package Caches

yay maintains its own cache directory for AUR build files in addition to pacman’s package cache. Cleaning these periodically recovers disk space.

Remove Unneeded Dependencies

Remove packages that were installed as dependencies but are no longer required:

yay -Yc

Clean Build Cache

Remove all cached AUR build files:

yay -Scc

This cleans both the pacman cache and yay’s AUR cache. You will be prompted to confirm deletion of cached packages and unused repositories.

Configure yay Behavior

yay stores its configuration in ~/.config/yay/config.json. You can modify settings using command-line flags with the --save option to persist them.

Enable Development Package Updates

Development packages (those ending in -git, -svn, -hg) track upstream version control rather than release versions. By default, yay does not check these for updates. Enable development package checking:

yay -Y --gendb

This generates a database of development packages. Then enable automatic updates:

yay -Y --devel --save

Now yay -Syu will also check development packages for upstream changes.

Skip PKGBUILD Review Prompts

If you trust the AUR packages you install and want to skip the diff review prompt:

yay --nodiffmenu --save

Skipping PKGBUILD review reduces security. Only disable this if you understand the risks and trust the packages you install.

Change Build Directory

By default, yay builds packages in ~/.cache/yay. To use a different directory:

yay --builddir /path/to/directory --save

Update yay

Since yay is itself an AUR package, it updates through the normal upgrade process:

yay -Syu

When a new yay version is available, it appears in the upgrade list like any other package. yay handles rebuilding and replacing itself during the upgrade.

Remove yay

If you no longer need yay, remove it using pacman directly.

Remove the Package

Uninstall yay and remove orphaned dependencies:

sudo pacman -Rns yay

If you installed yay-bin instead:

sudo pacman -Rns yay-bin

Remove Configuration and Cache

Delete yay’s configuration and build cache directories:

rm -rf ~/.config/yay ~/.cache/yay

Verify Removal

Confirm yay is no longer installed:

pacman -Qi yay

Expected output:

error: package 'yay' was not found

Removing yay does not remove AUR packages installed through it. Those packages remain on your system and can be managed with pacman or another AUR helper.

Troubleshooting

Cannot Run makepkg as Root

If you receive the error “Running makepkg as root is not allowed,” you are attempting to build packages as the root user. AUR packages must be built as a regular user for security reasons.

Solution: Log in as a non-root user or create one:

useradd -m username
passwd username
usermod -aG wheel username

Then switch to that user and run the installation commands.

PGP Key Verification Failed

Some AUR packages require PGP keys to verify source files. If the build fails with a key verification error, import the required key:

gpg --recv-keys KEY_ID

Replace KEY_ID with the key mentioned in the error message. Then retry the installation.

Package Build Fails

Build failures can occur due to missing dependencies, outdated PKGBUILDs, or upstream changes. First, ensure your system is fully updated:

yay -Syu

Check the AUR package page for comments from other users experiencing similar issues. Maintainers often post workarounds or updates.

If the package has been flagged as out-of-date on the AUR, consider waiting for the maintainer to update it or finding an alternative package.

Conflicts with Existing Packages

When installing a package that conflicts with an existing one, yay prompts you to remove the conflicting package first. If you want to proceed, confirm the removal when prompted.

If you accidentally decline, you can manually remove the conflicting package and retry:

sudo pacman -Rns conflicting-package
yay -S desired-package

yay Hangs During Update

If yay appears to hang while checking for updates, it may be waiting for user input that scrolled off the screen. Press Enter or check if there is a prompt waiting for a response.

For non-interactive updates (useful in scripts), add the --noconfirm flag:

yay -Syu --noconfirm

Using --noconfirm skips all prompts including PKGBUILD review. Only use this for trusted packages or automated systems where you accept the risks.

Common Questions

What is the difference between yay and yay-bin?

yay compiles the helper from source code using Go, which takes more time. yay-bin installs a pre-compiled binary, which is much faster. Both result in the exact same application, so yay-bin is recommended for most users.

How do I clean yay’s cache to free up disk space?

yay stores build files in ~/.cache/yay, which can grow large. Run yay -Scc to clean both the pacman and AUR caches. Alternatively, you can use yay -Sc to remove only uninstalled packages from the cache.

What does “Flagged out-of-date” mean in search results?

This status allows users to signal that the AUR package uses an older version than the official upstream software release. You can often still install it, but it may lack recent features or security fixes. Check the package comments for updates or workarounds.

Can yay manage Flatpak or Snap packages?

No. yay is designed strictly for Arch Linux official repositories and the AUR. For Flatpaks, use the flatpak command. For Snaps, use the snap command. yay does not interact with these containerized formats.

Is it safe to skip the PKGBUILD review?

Skipping the review is risky. The AUR is user-maintained, and reviewing the PKGBUILD file is your primary defense against malicious scripts or errors. Only skip this step if you have personally verified the package source or are working in a trusted automated environment.

How do I remove orphaned dependencies with yay?

Use the command yay -Yc. This scans for and removes dependencies that were installed for packages you have since removed, helping keep your system clean and minimizing clutter.

Additional Resources

For more information about yay and AUR package management, consult these resources:

You can also view yay’s built-in help and man page:

yay --help
man yay

Conclusion

You now have yay installed and configured for managing AUR packages on Arch Linux. The key commands to remember are yay -S package to install, yay -Syu to update everything, yay -Rns package to remove, and yay -Ss term to search. Always review PKGBUILDs when prompted, keep your system updated, and check AUR package comments when troubleshooting build failures. With yay handling the complexity of AUR package management, you can access the full breadth of community-maintained software while maintaining the security practices that make Arch Linux reliable.

Leave a Comment

Let us know you are human: