The Arch User Repository (AUR) is one of the most valuable assets for members of the Arch Linux community. With over 180,000 user-submitted packages, it provides practically limitless access to open source software. From essential utilities to exotic niche programs, the AUR enables Arch to live up to its reputation for versatility and customizability.
But newcomers often find the AUR confusing at first. Understanding how to access this wealth of software unlocks the full potential of Arch, allowing it to reshape itself to virtually any computing need. This comprehensive, 2600+ word guide aims to make the AUR accessible by covering finding, installing, creating, and maintaining packages.
The History and Ethos Behind the AUR
The AUR began in 2002 as a humble collection of user-submitted bash scripts under the name "ArchScripts". But as the Arch community grew at a breakneck pace, developers transitioned it to the current PKGBUILD-based system in 2006 and gave it its current name. The initial 400 packages exploded over the years into the current total of over 180,000.
The developers designed PKGBUILD files to compile software from source using makepkg. This scheme empowers the community itself to package up virtually any open source application or library – no barriers to entry for contributors or limit on scope.
This egalitarian design philosophy pervades the AUR‘s structure as essentially a disparate network of git repositories coordinating via a central website. The documentation even explicitly calls it "a loosely regulated community repository". By relying on peer review, the AUR balances this anarchic lack of central control with integrity and quality assurance.
But this communal spirit designed by Arch‘s founders has thrived beyond their expectations. The AUR‘s exponential growth testifies to the dedication of Arch "power users" willing to spend time packaging software for no reward except helping fellow members. Exploring and participating in the AUR is perhaps the purest expression of the UNIX philosophy at the heart of Arch Linux.
Understanding PKGBUILDs and Source Compilation
To harness the power of the AUR, a basic grasp of the mechanics behind it proves invaluable. At the core lies the makepkg utility and PKGBUILD metadata files.
When installing official Arch packages with pacman, pre-built binary files simply download to the system. But the AUR contains no binaries – only templates called PKGBUILDs for constructing the programs from their original source code using makepkg.
Here‘s an abbreviated example PKGBUILD:
pkgname=foobar
pkgver=1.0
pkgrel=1
...other metadata...
source=("${pkgname}-${pkgver}.tar.gz")
build() {
cd "$srcdir/$pkgname-$pkgver"
./configure --prefix=/usr
make
}
...other functions...
As seen above, a PKGBUILD mainly provides metadata and a set of instructions for the build process. After downloading the source files listed under source=, makepkg executes the commands in the build() function.
This runs the standard "./configure", "make", "make install" sequence typical of many open source applications written in C/C++. Finally, makepkg packages up the compiled binaries and supporting files into a functional .pkg.tar.zst package for pacman to install.
Now let‘s explore common methods for acquiring AUR packages.
AUR Helpers – Installing Packages the Easy Way
While theoretically anyone could download PKGBUILD sources, compile packages, and manually install them – that tedious process defeats the purpose of a package manager.
Instead, specialized "AUR helpers" automate finding packages, fetching sources, resolving dependencies, compiling binaries, avoidingcollisions with existing packages, generating meta-information, and ultimately installing them.
According to the 2022 survey conducted on /r/archlinux, the 5 most popular AUR helpers are:
| Helper | Market Share |
|---|---|
| yay | 63% |
| paru | 19% |
| pikaur | 7% |
| trizen | 5% |
| aura | 3% |
The above command line helpers all function similarly in operation, integrating with pacman to seamlessly install packages from AUR or the official repositories. But certain features distinguish them:
yay lives up to its popularity by sporting a simple interface while still offering versatility advanced configuration via command line flags or editing /etc/yay.conf.
paru shines when installing packages needing complex variable interpolation or patches, all while minimising conflicts via selective overwriting of conflicting files. The verbose colored output neatly presents progress details.
pikaur focuses specifically on system stability and good UX design. Informative logs, elegantly designed prompts/menus, and automatic resolution of major conflicts enhances first-time installation success over raw power or speed.
trizen allows editing PKGBUILDs before building and can split packages needing variable interpolation for compiling on multiple machines – ideal for developers.
aura prides itself on strict syntax checking and standardized output for easy post-processing of install reports. Batch install features also suit deployment of multiple identical systems.
With root-equivalent permissions, an AUR helper can be invoked using the same syntax as pacman:
$ yay -S <package1> <package2>
They accept all of pacman‘s flags for controlling various aspects of the install process. See the manpage or documentation of your chosen helper for specifics.
Building Packages Without Helpers
Alternatively, compiling and installing an AUR package manually closely resembles creating one‘s own. The key steps come down to:
- Downloading the tarball
- Extracting it
- Running makepkg
This example installs the "foobar" package:
$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/foobar.tar.gz
$ tar -xvf foobar.tar.gz
$ cd foobar
$ makepkg -si
We fetch the tarball snapshot containing the PKGBUILD and other sources, extract it, enter the package directory, and finally let makepkg compile and install it.
Going manual like this provides insight into the process and requires no extra tools. However, resolving dependencies and avoiding file conflicts burden the user instead of the helper. Troubleshooting build errors also pushes AUR novices to their limit. For most, a helper smooths out this fluctuation of complications.
Contributing Back – A Step-by-Step Guide
While using mature packages from the AUR expands possibilities, contributing new ones gives back to the community enabling such potential. The developer background required surprises beginners expecting programming instead of package assembly.
Carefully read all the guidelines on creating packages before starting. Pay particular attention to formatting standards.
Follow this step-by-step process for publishing packages:
Step 1) Check if the software already has a package. Duplicates get rejected. Also verify the license permits redistribution – no pirated or patented applications!
Step 2) Fork the AUR git repository template. Copy the files instead of creating your own to match expectations:
$ git clone ssh://aur@aur.archlinux.org/foobar.git
Step 3) Fill out the PKGBUILD metadata fields. Set pkgname, pkgver, pkgrel correctly and indicate any dependencies.
Step 4) Add the source array linking download URLs for the software and any patches.
Step 5) Write the build() function to compile from source after extracting. Refer to other packages with similar build systems.
Step 6) Test! Locally compile and install the package in a chroot or VM first. Check for errors or missing dependencies.
Step 7) Commit changes and push to the AUR. First sync any pending updates.
$ git pull origin master
$ git add -A .
$ git commit -m "Initial commit foobar 1.0"
$ git push origin master
After submitting, monitor the package comments page for any user bug reports. If issues arise, revise the package based on feedback. Otherwise, enjoy providing new software for all Archers worldwide!
Showcasing Powerful AUR Exclusives
At over 180,000 packages, browsing the AUR for hidden gems that expand Arch‘s capabilities becomes addictive. While the community packages plenty of obscure apps and libraries, a few unusual packages best showcase the strengths of such an open model.
Want to play games without dual-booting Windows? Both lutris for running GOG/Steam games and retroarch for emulation exist solely on the AUR.
Is Android development easier on its native OS? Anbox‘s anbox-image-gapps AUR package leverages Linux namespaces to virtualize Android on any Arch system.
Do you need transcribing software calibrated for Indian languages not supported by commercial services? The academics behind indic-speech-to-text provide an open research tool in the AUR pending official inclusion by Arch.
Obscure patches to commercial software also hide in the AUR‘s endless obscurities. When Adobe refused to fix major GPU bugs in the Linux adobe-dng-converter preventing RAW photo processing, an Arch user submitted unofficial patched builds that became essential for Linux photography workflows.
For every interest or field imaginable, someone in the Arch community likely created specialized AUR software. But due diligence on security and package quality remains essential toward benefiting from this open model safely.
Evaluating and Securing AUR Packages
The decentralized nature of the AUR inevitably leaves room for malicious packages slipping past community review. Without an formal vetting process, users must critically examine packages themselves before installing. Generally:
- Inspect the PKGBUILD code and any patches
- Scan comments for any reports of misbehavior
- Search the package name in Arch security notices
- Check the maintainer‘s reputation if unfamiliar
Also prefer popular packages actively maintained and avoid bleeding edge versions that see less testing. Consider checking the source code of packages handling sensitive data like passwords or logins.
If time-constrained, adding the following snippet to /etc/makepkg.conf verifies authenticity of packages signed by trusted developers:
CHECKSUMS=(sha512)
VALIDPGPKEYS=() #key fingerprints here
Overall, balance skepticism toward new packages with reasonable trust in the community. The AUR‘s crowdsourced model works thanks to dedicated maintainers and watchful users. Make bug reports as needed while following basic precautions.
Customizing AUR Helpers for Specialized Use
While most users can use AUR helpers as is, tweaking their configuration or adding parameters during execution caters to niche build requirements. Both system-wide and per-user settings files exist for purposes like:
- Setting compiler flags like
-march=nativefor performance or-pipeto run gcc optimizations sequentially - Changing paths to stores for built binaries, cached sources, or package installation
- Enabling simulation modes just to debug builds without actual installation
- Overriding packages‘ default extraction, build and packaging steps
For example, creating a ~/.config/yay/yay.conf file with the following forces parallelized compilation on all packages:
[makepkg]
MAKEFLAGS=‘-j$(nproc)‘
Power users may create presets to quickly enable or disable collections of such optimizations with aliases:
alias yaysafe=‘yay --mflags --skipinteg‘
alias yayfast=‘yay --nocheck --mflags "--j$(nproc) -pipe"‘
Learning usage quirks and abilities of AUR helpers pays dividends for both contributing and installing packages faster. Consult each helper‘s manpages and -h help for further customization.
Maintaining Packages Up-to-Date
The existing wealth of packages makes it easy to forget the AUR relies wholly on maintainer dedication. The smallest contribution like monitoring a useful package already benefits the entire user base. Notify maintainers to update versions or try submitting patches for bugs on outdated packages.
But willing contributors can also adopt orphaned packages seeing previous updates. After searching the AUR for the desired software, navigate to its page and click the link near the top labeled "Request Maintainer". After approval, submit commits to update source URLs/hashes for new versions or fix reported issues.
If lacking a whole orphaned niche‘s packages, experienced contributors may even create an entirely new ones as outlined previously. Eventually consider migrating mature packages to the [community] repository for official inclusion as an Arch developer.
By spending just occasional minutes or hours checking packages, every member strengthens the extensive mesh of peer support enabling the AUR to contain essentially infinite software variety.
Conclusion
As one of Arch‘s greatest assets, the AUR fulfills the original vision of maintaining unlimited versatility only through community collaboration. Mastering its vocal dialect of package compilation unlocks access to this universe of crowd-sourced software.
From essential apps to exotic niche scripts, someone among Arch‘s ranks created a tool for every purpose. But fully benefiting from this work depends wholly on members installing, testing, providing feedback on, and improving packages. Only through weathering the intrinsic growing pains of its decentralized model will each AUR package mature.
Yet the payoff beyond without doubt merits the costs. Learning the inner workings of PKGBUILDs or how to publish new packages returns multiplied dividends over a lifetime of using Arch. Possessing an integral understanding of how the sausage gets made ultimately allows everyone to enjoy it worry-free.
So while the AUR may appear arcane or intimidating at first glance to newcomers, viewing it instead as an opportunity to converse with fellow developers reveals Arch Linux at its finest. Its imperfections outright display the transparency by which the distribution learns from direct community participation. Together, both sides better approximate the all-encompassing operating system envisioned over a decade ago.


