HeadlinesBriefing favicon HeadlinesBriefing.com

Pkgsrc: NetBSD Package Manager for Cross-Platform Source Builds

Hacker News •
×

The author discovered pkgsrc via Mastodon and now uses it to build Emacs from source on Debian. Pkgsrc is NetBSD's package manager, portable across Linux, macOS, Solaris, and other Unix-like systems. Originally forked from FreeBSD's Ports collection decades ago, it correctly uses "packages" terminology versus "ports" for CPU architectures. Similar projects include MacPorts, Gentoo's emerge, GNU Guix, and Ravenports.

The author prefers pkgsrc because it separates the base system from user-installed software. By default, pkgsrc installs to /usr/pkg with its own bin/lib tree, avoiding pollution of /bin and /lib. On Debian, the author uses unprivileged mode with ~/pkg as the base directory, creating a self-contained userland without sudo.

Pkgsrc is a collection of Makefiles defining build processes, dependencies, source download URLs, and patches. It uses GitHub release tarballs for versioned source downloads without requiring git. This approach answered the author's question about why projects publish source tarballs.