Jump to content

Pkgsrc

From ArchWiki

Pkgsrc is a cross-platform package manager. It originates from NetBSD and it has support for GNU/Linux and many other UNIX-like operating systems.

Installation

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

Reason: There is netbsd-pkgsrcAUR, we don't need a copy of upstream instructions for the unprivileged installation. (Discuss in Talk:Pkgsrc)
Note Pkgsrc is not the official package manager of Arch Linux and it's not officially supported by Arch Linux developers.

Next we will install Pkgsrc package manager. First, you need to fetch the Pkgsrc tree. There are a few ways we can do this, and the choice is yours.

  1. You can manually use CVS or Git to clone the Pkgsrc tree from source control.
  2. You can manually download a snapshot of the Pkgsrc tree, or
  3. You can install the netbsd-pkgsrcAUR package from the AUR, which automatically fetches the latest quarterly snapshot of the Pkgsrc tree.

If you lack root rights on the system you use, you may wish to use an alternative method to fetch the Pkgsrc tree and do an unprivileged bootstrap of Pkgsrc under your home directory. Please refer to the official Pkgsrc documentation for details on how to do an unprivileged installation.

Instead, we are here going to choose to use the relevant package from the AUR, which requires root rights.

Installing Pkgsrc

First install the netbsd-pkgsrcAUR package from the AUR. After the package is installed, you need to follow the instructions that were printed by makepkg utility. In short, you need to do the following steps as root user to bootstrap Pkgsrc.

We need to first navigate to the directory that contains the Pkgsrc tree.

# cd /usr/pkgsrc/bootstrap

Then we will remove the leftover files from the previous version of the Pkgsrc bootstrap (if they exists).

# rm -ri work

Finally, we will bootstrap the Pkgsrc by running the script as root user. This will install binaries and other required files under /usr/pkg prefix. Note that the Pkgsrc package definitions are located under /usr/pkgsrc directory.

# ./bootstrap --prefix /usr/pkg


After the bootstrap script was executed successfully, you should make sure that the Pkgsrc's /pkg/bin and /pkg/sbin directories are added to your PATH environment variable. The AUR package should do this automatically. But to have the changes take effect immediately, you may need to reopen your terminal or re-login to your TTY session (sourcing /etc/profile should also help).

Installing packages with Pkgsrc

Note bmake is the NetBSD version of the make utility. It supports different command-line options than the make from the GNU project.

Let's use the shells/tcsh package as an example. We need to first navigate to the directory that contains the Pkgsrc tree.

# cd /usr/pkgsrc

Next we will find the directory that contains the desired package.

# cd shells/tcsh

Then We will execute the install target of the makefile as root user.

# bmake install

Now tcsh should be installed from Pkgsrc, and the program may be used normally.

Uninstall Pkgsrc

To uninstall Pkgsrc, you can simply uninstall the AUR package. To remove the binaries that you have installed with Pkgsrc package manager, you need to manually remove the /usr/pkgsrc directory as well.

See also