How to fix Pacman: command: not found

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to fix "pacman: command: not found" error on Arch Linux.

Pacman is the default package manager for Arch Linux, which you can use to manage your packages on Arch Linux.

When pacman is not installed, or not configured correctly, you get the following error " pacman: command not found".

Fix Pacman command not found

Pacman can be used to install or uninstall packages. However, in this case you can't use pacman to install pacman because pacman doesn't work.

This is a simple error, and it can be fixed easily by reinstalling pacman again. Since we can't use pacman to download anything, we need to download pacman via wget and then install it.

Step 1 - Download Pacman

First, you need to download Pacman source code. To do this, you can use wget.

wget -nv https://sources.archlinux.org/other/pacman/pacman-6.0.2.tar.xz

💡
Note: We downloaded Pacman source code using the no verbose option -nv. No verbose allows you to download stuff without seeing the full output, in our case we needed to know only when the source code was downloaded.

Step 2 - Extract Pacman source code

Now you need to extract the content of Pacman source code pacman-6.0.2.tar.xz into your machine.

You can use the tar command to do this.

tar -xJf pacman-6.0.2.tar.xz

Step 3 - Install Pacman

Next, proceed to install Pacman. Installing pacman is done by building the source files that you downloaded.

1) First, navigate to pacman-6.0.2 directory

cd pacman-6.0.2

2) Now to install Pacman, you need to run the commands below one by one.

./configure --prefix=/usr
sudo make
sudo make install

Step 4 - Use Pacman

Now you should be able to use pacman, and the error should be gone.

To see if pacman was installed correctly, and that is able to perform a task such as checking for updates for example, then you can run the following command below

sudo pacman -Syu

Conclusion

In this tutorial, you learned how to fix the error "pacman: command: not found" on Arch Linux. We also explained why this error happens, and how you can resolve this error easily by installing pacman when pacman is not installed on your Arch Linux machine.

By now you should be able to use pacman on your Arch Linux machine, to install, update or uninstall any package you want.

If you are having trouble setting up pacman when building from source, you can check another way of installing pacman in our tutorial.