Install Software from the AUR: A Complete Guide
In this article
To install software from the Arch User Repository (AUR), you must clone the package build script from the AUR website, install the necessary build dependencies, and then run the makepkg command to compile and install the software. Because the AUR contains community-submitted build scripts rather than pre-compiled binaries, you are essentially automating the process of downloading the source code, patching it if necessary, and packaging it into a format that the Arch Linux package manager can handle. This process allows you to access a massive library of software that is not available in the official Arch repositories.
What You'll Need
- A working installation of Arch Linux or an Arch-based distribution (such as EndeavourOS or Manjaro).
- An active internet connection to download source files and dependencies.
- The
base-develpackage group installed (this provides the essential tools like gcc, make, and binutils needed for compiling software). - Git installed on your system to clone the repository.
- A non-root user account with sudo privileges.
Step-by-Step
- Install Build Essentials: Before you can use the AUR, you must ensure your system has the tools required to build packages from source. Open your terminal and run
sudo pacman -S --needed base-devel git. The--neededflag ensures that pacman only installs packages that are not already present on your system. Withoutbase-devel, the build process will fail almost immediately because the system will not find the compiler or the make utility. - Find the Package: Navigate to the official Arch User Repository website. Use the search bar to find the software you want to install. Each package page will provide a unique "Git Clone URL". Copy this URL to your clipboard. For example, if you are looking for a specific browser or a system utility, the URL will typically end in
.git. - Clone the Repository: Open your terminal and navigate to a directory where you want to keep your build files. It is common practice to create a folder named
~/buildsor~/aurto keep these files organized. Run the commandgit clone [URL], replacing[URL]with the link you copied from the website. This creates a new directory named after the package containing thePKGBUILDfile. - Enter the Package Directory: Change your working directory to the newly created folder using the command
cd [package-name]. You must be inside the folder containing thePKGBUILDfile for the next steps to work. - Inspect the PKGBUILD: This is a critical security step. Because the AUR is community-driven, anyone can upload a script. Before running it, open the
PKGBUILDfile with a text editor (such as nano or vim) and review thesourceandbuildsections. Ensure the software is being downloaded from an official source and that there are no suspicious commands being executed. - Build and Install the Package: Run the command
makepkg -si. Here is what these flags do: the-sflag tells the system to automatically resolve and install any missing dependencies using pacman, and the-iflag tells the system to install the package once it has been successfully compiled. You will be prompted for your sudo password to complete the installation of dependencies and the final package. - Clean Up: Once the installation is complete and you have verified the software works, you can delete the cloned directory to save space, or keep it if you intend to update the software manually in the future.
Common Mistakes
One of the most frequent errors is attempting to run makepkg as the root user. For security reasons, makepkg is designed to fail if run as root. You must run the command as a normal user with sudo privileges; the script will ask for the root password only when it needs to install the final package or its dependencies. Another common mistake is forgetting to install the base-devel group. Many users assume that because they have a working system, they have a compiler, but Arch is minimal by design. If you see errors like "make: command not found" or "gcc: command not found," it is because base-devel is missing.
Users also frequently forget to update their system before installing from the AUR. If your system is out of date, you may encounter "dependency version mismatch" errors. This happens when the AUR package requires a newer version of a library than what is currently installed on your machine. Always run sudo pacman -Syu before starting an AUR installation to ensure your system libraries are current.
Tips
To make the process more efficient, consider using a dedicated directory for all your AUR clones. This prevents your home folder from becoming cluttered with various build directories. If you find yourself installing many AUR packages, you might look into the concept of AUR helpers. While the manual method described above is the safest and most transparent way to learn how the system works, helpers automate the cloning and updating process. However, always remember that helpers hide the PKGBUILD from your immediate view, so manual inspection is still recommended for unfamiliar software.
When reviewing a PKGBUILD, look for the pkgver variable. This tells you the version of the software being installed. If the version is significantly behind the official upstream release, the package might be orphaned or outdated. You can check the "Last Updated" date on the AUR website to see if the maintainer is still active. If a package is orphaned, you can actually adopt it yourself to keep it updated for the community.
Troubleshooting
If the build process fails with a "PGP signature could not be verified" error, it means the package is signed with a developer's key that is not in your local keyring. To fix this, you need to import the key manually. Look for the key ID in the error message (usually a long string of numbers and letters) and run gpg --recv-keys [KeyID]. Once the key is imported, run makepkg -si again.
If you encounter a "file exists in filesystem" error during the installation phase, it usually means you previously installed the software manually or through another method, and pacman is refusing to overwrite existing files. If you are certain the files belong to the package you are installing, you can use sudo pacman -S --overwrite "*" [package-name], but be extremely cautious with this command as it can overwrite critical system files if used incorrectly. The safest approach is to identify the conflicting files and remove them manually before running makepkg again.
If the compilation process hangs or consumes all your system RAM (common with large packages like browsers), you can limit the number of cores used for compilation. By default, makepkg uses the settings in /etc/makepkg.conf. You can edit this file and change the MAKEFLAGS variable (e.g., MAKEFLAGS="-j2") to restrict the build to two CPU cores, which reduces memory pressure and prevents the system from freezing.
Frequently Asked Questions
Is the AUR safe to use?
The AUR is community-maintained, meaning anyone can upload a package. While most packages are safe and well-vetted, there is a risk of malicious scripts. This is why inspecting the PKGBUILD file before running the installation is mandatory for a secure system.
How do I update software installed from the AUR?
Software from the AUR is not updated by sudo pacman -Syu. To update a package manually, you must cd into the original cloned directory, run git pull to get the latest PKGBUILD, and then run makepkg -si again.
What is the difference between the official repositories and the AUR?
Official repositories contain pre-compiled binaries that are tested and maintained by Arch Linux developers. The AUR contains build scripts (PKGBUILDs) created by users that download and compile software on your own machine.
Can I uninstall AUR packages using pacman?
Yes. Once a package is installed via makepkg -si, it is registered in the local pacman database. You can remove it using the standard sudo pacman -Rs [package-name] command.
What are "-bin" packages in the AUR?
Packages ending in -bin provide pre-compiled binaries instead of building from source. These install much faster because they skip the compilation step, but they offer less transparency as you cannot easily verify the build process from the source code.