Inspect AUR PKGBUILDs Before Running makepkg -si on Arch Linux
Review community PKGBUILD scripts before building and installing AUR packages on Arch Linux.
08 Jul 2025, 21:38 UTC

The problem: AUR packages are community scripts, not official packages
You need a tool that exists only in the Arch User Repository (AUR). The common instruction is to run makepkg -si, but that command downloads a community-submitted PKGBUILD script, executes it on your machine, and then installs the resulting package with root privileges. If you have not read the script, you are running untrusted code.
The useful takeaway is simple: treat every AUR PKGBUILD as untrusted source code. Inspect it before you build, verify what it downloads and installs, and only then run makepkg.
What makepkg and the AUR actually do
makepkg is Arch Linux's official package builder. It reads a PKGBUILD—a shell script that defines source URLs, checksums, dependencies, and build steps—downloads the sources, verifies their integrity, compiles the software, and produces an installable .pkg.tar.zst package.
The AUR hosts these PKGBUILD files, but Arch developers do not maintain or vet them. A malicious or careless maintainer can embed arbitrary commands in the build or package functions. makepkg verifies checksums only against the values written in the same PKGBUILD, so a compromised file can pass its own integrity check.
You need the base-devel group installed to compile packages, and git to fetch AUR sources. Confirm the tooling is present as a regular user:
pacman -Q makepkg base-devel
Expected output lists installed versions for both. If either is missing, install base-devel before proceeding.
Inspect before you build
Clone the AUR snapshot rather than piping a remote script directly to a shell:
git clone https://aur.archlinux.org/.git cd
Run these as a regular user. makepkg refuses to build as root by default, which protects the host from accidental root-owned build artifacts.
Open the PKGBUILD with less or your editor and review:
source— where files come from; avoid unfamiliar third-party URLs.sha256sumsormd5sums— whatmakepkgverifies after download.dependsandmakedepends— packages that will be pulled onto your system.buildandpackagefunctions — the commands that actually run during compilation and installation.
You can view package metadata without starting a build:
makepkg --printsrcinfo | less
This shows the resolved package name, version, dependencies, and other fields that makepkg would pass to pacman.
Worked example: build and install one AUR package
After reviewing the PKGBUILD, build and install as a regular user:
makepkg -si
-s tells makepkg to install missing build dependencies automatically, and -i installs the finished package with pacman. Both steps may elevate privileges through sudo, so review the dependency list before you run the command.
Confirm the installation:
pacman -Q
If the package appears with a version number, the build succeeded. If the PKGBUILD contained anything suspicious—hidden network calls, obfuscated commands, or unexpected rm -rf operations—abort before running makepkg.
Because makepkg -si changes system state, you can reverse it later:
sudo pacman -Rs
This removes the package and its unneeded dependencies.
Trade-offs and limitations
AUR packages are not covered by Arch's official support. A system update can break an AUR package if it depends on a library that changed; Arch does not support partial upgrades, so you should update the whole system and rebuild affected AUR packages when something breaks.
Building in an isolated chroot with devtools keeps the host clean, but it adds setup time and does not make a malicious PKGBUILD safe—it only limits where the damage can happen.
Finally, automatic dependency installation with -s can pull in packages you did not intend to install. Read the depends array first, or build without -s and install dependencies manually.
Closing checklist
- Clone the AUR repository.
- Read the
PKGBUILD, sources, checksums, and dependency list. - Run
makepkg --printsrcinfoto review metadata. - Run
makepkg -sionly after you are satisfied. - Verify with
pacman -Q.
If anything in the script looks wrong, do not build it. The AUR is useful precisely because you can inspect what you are about to run.