pkgin, a NetBSD package manager

pkgin is aimed at being an apt / yum like tool for managing pkgsrc binary packages. It relies on pkg_summary(5) for installation, removal and upgrade of packages and associated dependencies, using a remote repository.


Execute the following commands a root in order to install pkgin, for more information check install binary packages (NetBSD)

# PKG_PATH="$(uname -p)/$(uname -r|cut -f '1 2' -d.)/All/"
# export PKG_PATH
# pkg_add pkgin

Initialize/Update repo definition

The following command allows you to initialize or update the database that contains the definition and information of the available packages.

# pkgin update

It is recommended to run the above command regularly to keep the operating system up to date.


List availables packages

# pkgin avail
0verkill-0.16nb1     0verkill is bloody 2D action deathmatch-like game in ASCII-ART
2048-cli-0.9.1       The game 2048 for your Unix terminal
2bwm-0.3             Fast floating WM written over the XCB library and derived from mcwm
2fa-1.1.0nb18        Command-line client for two-factor authentication
2vcard-0.6nb1        Convert an addressbook to the popular VCARD file format
3ddesktop-0.2.9nb13  3D Virtual Desktop Switcher
3proxy-0.8.11        Multi-protocol proxy
4stAttack-2.1.4nb20  Game in which you have to try to out-smart your opponent
6tunnel-0.13         Tunnelling for applications that don't speak IPv6
7kaa-2.15.4p1nb1     Seven Kingdoms: Ancient Adversaries

List installed packages

# pkgin list
pkgin list 
pkg_install-20210308 Package management and administration tools for pkgsrc
pkgin-20.12.1        Apt / yum like tool for managing pkgsrc binary packages
vim-8.2.2557         Vim editor (vi clone) without GUI
vim-share-8.2.2557   Data files for the vim editor (vi clone)


With this command with search for all packages that contains the word nginx

# pkgin search nginx
nginx-1.19.6         Lightweight HTTP server and mail proxy server
nginx-1.18.0nb8      Lightweight HTTP server and mail proxy server

Search using regular expression

With this command with search for all packages that starts with apache word followed by – and 1 digit.

# pkgin search '^apache\-[[:digit:]]' 
apache-2.4.46nb2     Apache HTTP (Web) server, version 2.4

Install/update a package and its dependencies

The install subcommand allows to install/update packages.

# pkgin install nginx
calculating dependencies...done.

2 packages to install:
  nginx-1.19.6 pcre-8.44

0 to refresh, 0 to upgrade, 2 to install
944K to download, 4698K to install

proceed ? [Y/n]

It is also possible to install several packages at the same time by separating the packages by a blank space.

Uninstall a package.

Remove a package and its dependencies.

# pkgin remove curl   
5 packages to delete: 
  cmake-3.19.2 git-2.29.2 git-base-2.29.2 git-contrib-2.29.2 curl-7.74.0

Remove orphan dependencies

# pkgin autoremove

Show information about a package.

# pkgin pkg-descr nginx 
Information for
Nginx (pronounced engine-x) is a free, open-source, high-performance HTTP
server and reverse proxy, as well as an IMAP/POP3 proxy server. Igor Sysoev
started development of Nginx in 2002, with the first public release in 2004.
Nginx now hosts nearly 12.18% (22.2M) of active sites across all domains.
Nginx is known for its high performance, stability, rich feature set, simple
configuration, and low resource consumption.
Nginx is one of a handful of servers written to address the C10K problem.
Unlike traditional servers, Nginx doesn't rely on threads to handle requests.
Instead it uses a much more scalable event-driven (asynchronous) architecture.
This architecture uses small, but more importantly, predictable amounts of
memory under load.
Even if you don't expect to handle thousands of simultaneous requests, you can
still benefit from Nginx's high-performance and small memory footprint.
Nginx scales in all directions: from the smallest VPS all the way up to
clusters of servers.
Nginx powers several high-visibility sites, such as Netflix, Hulu, Pinterest,
CloudFlare, Airbnb,, GitHub, SoundCloud, Zynga, Eventbrite,
Zappos, Media Temple, Heroku, RightScale, Engine Yard and NetDNA.

Update all packages

# pkgin full-upgrade

Clean the cache

# pkgin clean

Find package dependencies

Run the following commands to get all the dependencies of a package.

Direct dependencies

# pkgin show-deps curl     
direct dependencies for curl-7.74.0

Reverse dependencies

# pkgin show-rev-deps curl
local reverse dependency tree for curl

All dependencies

# pkgin show-full-deps curl
full dependency tree for curl-7.74.0

Find package requirements

With the following command we find all module/libraries which a package depends on.

# pkgin requires curl       
Shared libraries required by curl-7.74.0:

Show shared libraries.

With the following command we find all libraries that a package shares with other packages.

# pkgin provides curl
Shared libraries provided by curl-7.74.0:

Show all files contained in a package

# pkgin pkg-content nginx 
Information for

Show the category to which a package belongs

# pkgin spc nginx
www          - nginx-1.19.6
www          - nginx-1.18.0nb8


  • man pkgin
  • pkgin -h

Related links

YouTube video

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.