makepkg is a script that creates a foreign (i.e. non-repo) package, which can be installed using
Before we can make a package, we need to have both
git packages installed:
sudo pacman -S base-devel git --needed
On EndeavourOS, these should already be preinstalled.
Typically, making a package from the AUR involves the following steps:
- Find the package on aur.archlinux.org/packages
- Find the “Git Clone URL” for the package.
- Download everything needed to build the package (“clone”) using the
git clone command.
cd into the directory where everything downloaded, including the PKGBUILD file.
- Open the PKGBUILD file in a text editor and inspect it for anything suspicious (see my tips on what to look out for)
makepkg -si inside the directory where the PKGBUILD file is.
makepkg command, the option
-s means “automatically install dependencies (including installing make-dependencies – programs needed to build the program you’re packaging)”, and
-i means “if package is built successfully, install it”. If you don’t provide the
makepkg will only create the package, which you can install later manually using
pacman -U command.
Here is a concrete example:
On vanilla Arch, you don’t get the program
yay preinstalled, and it is not available in the official repos (so
sudo pacman -S yay will not work). This is probably intentional to force you to go through the above process at least once in your life. So you would do the following:
- Find the AUR page for
yay, this is it: https://aur.archlinux.org/packages/yay/
- Look under “Git Clone URL” and you’ll see it says this:
Take this opportunity to look at the package popularity, the names of the maintainer and the last packager, date when it was last updated, etc… and also to read the comments if there is anything unusual you should pay attention to. Clearly,
yay is a very popular AUR package!
- Run the following command:
git clone https://aur.archlinux.org/yay.git
- Notice that a directory named
yay has been created.
cd into it:
- Notice that there is a PKGBUILD file inside. We can quickly glance through it using the
Looks like a normal PKGBUILD to me1 , nothing malicious in there, so we’re good to go (hit Q to exit
Wait… When prompted to enter your
sudo password, do it. And there you go, now you have
yay installed (assuming there were no errors).
Of course, when it comes to
yay on EndeavourOS specifically, you don’t have to do this, because the
yay package happens to be in the
endeavouros repo, for our convenience. So we can just
sudo pacman -S yay (we don’t even need to do this, because EndeavourOS comes with
This whole process of building and installing a package from the AUR is what an AUR helper like
yay does automatically for you (except step 5, but
yay gives you a convenient way to look at the PKGBUILD file), and it also keeps track of all installed foreign packages, and allows you to update them when they are updated on the AUR. This is why, normally, you should use an AUR helper, because it makes life so much easier. But in order to understand what’s going on, and avoid potential pitfalls, it’s beneficial to know how to do this manually.
With time and experience, you’ll be much more comfortable with all of this.
To learn how to use
yay to automate this process:
1 Famous last words…