pkgsrc

pkgsrc is a framework for managing third-party software on UNIX-like systems. It currently contains more than 26,000 free packages. It is the default package manager of NetBSD and SmartOS, and can be used to enable freely available software to be built easily on a large number of other UNIX-like platforms.

For more information see pkgsrc official website. For more tutorials see pkgsrc documentation.

How to Install pkgsrc?

You can use the SStack tool to install pkgsrc to manage software on discovery.

For example, to install pkgsrc stack named 2024A in your home directory, run command:

sstack install -t pkgsrc -n 2024A

This creates a module file that you can load in your environment to be able to use the stack to manage software, as shown in the following:

module use "/fs1/home/tahat/sstack/rhel_8/modules"
module load pkgsrc/2024A

To check if pkgsrc was installed successfully, run:

pkg_info

This shows the installed packages.

mktools-20220614    Collection of pkgsrc mk infrastructure tools
nbpatch-20151107    Patch files using diff output
libtool-base-2.4.7nb1 Generic shared library support script (the script itself)
ncurses-6.4         CRT screen handling and optimization package
bmake-20200524nb1   Portable (autoconf) version of NetBSD 'make' utility
ncursesw-6.4        Wide character CRT screen handling and optimization package
pkg_install-20211115 Package management and administration tools for pkgsrc
bootstrap-mk-files-20230509 *.mk files for the bootstrap bmake utility
pkgconf-2.0.2       API-driven pkg-config replacement
cwrappers-20220403  pkgsrc compiler wrappers
digest-20220214     Message digest wrapper utility

How to Use pkgsrc to Manage Software?

SStack contains different wrapper scripts to manage software packages, such as pkg-search, pkg-install and pkg-uninstall.

Search for a Package

You can search for a package in pkgsrc using pkg-search. For example, to search for nano, run:

pkg-search nano

This shows you, if nano is available.

Available Packages
nano

Installing Packages

pkg-install binary installs a package from source. Once a package is installed, it will be added to PATH environmental variable. For example, to install nano, run:

pkg-install nano

Once the package is installed, you can check if it’s installed successfully. Run:

which nano

This should show you that you are using the package you installed not default one that is already installed in the system.