PORTS(7) Miscellaneous Information Manual PORTS(7)

portsoptional software with pkgsrc

Ports is the MOUSE layer for user-selected software. It uses pkgsrc and installs below /usr/local; it is unrelated to the FreeBSD Ports Collection. Ports is separate from World policy, release contents, and static-linkage guarantees, although packages compile against the headers and libraries supplied by World.

World never includes pkgsrc, a package database, pkgsrc configuration, or pkgsrc cache and work directories. An administrator who wants optional software bootstraps an unmodified upstream checkout after installation.

The following creates a pkgsrc checkout owned by the current administrative user and installs pkgsrc below /usr/local:

doas install -d -o "$(id -un)" -g wheel /usr/local/src
doas install -d -o "$(id -un)" -g wheel /var/cache/pkgsrc/distfiles
doas install -d -o "$(id -un)" -g wheel /var/cache/pkgsrc/packages
doas install -d -o "$(id -un)" -g wheel /var/tmp/pkgsrc
git clone --depth=1 https://github.com/NetBSD/pkgsrc.git /usr/local/src/pkgsrc
cd /usr/local/src/pkgsrc/bootstrap
doas ./bootstrap \
    --prefix /usr/local \
    --pkgdbdir /var/db/pkg \
    --sysconfdir /usr/local/etc \
    --varbase /var \
    --workdir /var/tmp/pkgsrc-bootstrap \
    --mk-fragment /usr/src/base/pkgsrc/mk.conf

The fragment selects MOUSE's Clang toolchain and the package state paths above. It is a bootstrap template only; World does not install it as active configuration.

Select a package directory and build it with the bootstrap's BSD make:

cd /usr/local/src/pkgsrc/category/package
/usr/local/bin/bmake
doas /usr/local/bin/bmake install

The package Makefile resolves dependencies, fetches distribution files, and builds in the pkgsrc work area. The install step records the installed files in the package database. Use bmake package when a reusable binary package is required. Use bmake clean afterward to discard that package's work directory.

Update the checkout as its owning user:

cd /usr/local/src/pkgsrc
git pull --ff-only

Review pkgsrc changes before rebuilding installed packages. Updating the checkout changes available package recipes but does not itself replace an installed package or any World file.

/usr/src/base/pkgsrc/mk.conf
MOUSE's optional pkgsrc bootstrap template.
/usr/local/src/pkgsrc
Administrator-managed upstream pkgsrc checkout.
/usr/local
Installed Ports programs, libraries, data, and package configuration.
/usr/local/etc/mk.conf
pkgsrc configuration created by bootstrap.
/usr/local/etc/init.d
Optional OpenRC service definitions installed by Ports. Enable them persistently in rc.conf(5).
/var/cache/pkgsrc/distfiles
Downloaded source archives.
/var/cache/pkgsrc/packages
Created binary packages.
/var/db/pkg
Installed package database.
/var/tmp/pkgsrc
pkgsrc work directories.

World contains the NetBSD pkg_* administration utilities. They are not a pkgsrc checkout or installed package set. Bootstrapping creates the package database and its own build tool below /usr/local.

Ports may install only below /usr/local and into the package state and cache paths listed above. Package configuration belongs below /usr/local/etc. Persistent service enablement remains in /etc/rc.conf, because service policy belongs to MOUSE even when the service executable came from Ports.

MOUSE uses pkgsrc because it combines excellent documentation and an extensive package collection with support for most Unix-like operating systems. It remains administrator-installed so a MOUSE release contains only World and does not silently acquire a mutable third-party source tree.

MOUSE uses unmodified upstream pkgsrc. Package Makefile syntax, package creation, infrastructure changes, and pkgsrc developer procedure are therefore defined by the upstream pkgsrc guide and pkgsrc developer's guide. MOUSE documents only its bootstrap layout and the boundary between Ports and World.

pkg_add(1), pkg_admin(1), pkg_delete(1), pkg_info(1), rc.conf(5), hier(7), mouse(7), world(7)

MOUSE September 1, 2026 PORTS(7)