Package management tool for FreeBSD. Help at #pkg on Libera Chat or pkg@FreeBSD.org
  • C 82.1%
  • Shell 16.5%
  • Makefile 0.9%
  • SmPL 0.5%
Find a file
Gordon Tetlow db212077cd Fix signatures by properly getting string lengths.
In the conversion from xstring to sb, 2 length variables were missed causing
all signatures to fail.

Fixes:	88021b4c7a
2026-09-19 20:57:00 +02:00
.builds alpine: fix the 15 failing tests 2026-08-21 12:38:48 +02:00
.github/workflows build: clean up dev build logic 2026-08-20 10:34:27 +02:00
compat compat: restore humanize_number and strtonum for macOS 2026-08-20 18:30:03 +02:00
docs rwhich: add a global configuration and a per repo configuration 2026-07-24 11:49:37 +02:00
external Remove the embedded sha256 for the libecc version. 2026-09-12 21:14:55 +02:00
libpkg Fix signatures by properly getting string lengths. 2026-09-19 20:57:00 +02:00
mk mk: let the environ choose the install command 2026-09-12 21:15:30 +02:00
scripts Fix available repositories completion 2026-09-12 21:16:18 +02:00
src mk: let the environ choose the install command 2026-09-12 21:15:30 +02:00
tests create: use bsdtar in override_prefix test 2026-08-21 13:09:27 +02:00
.clang-format Update clang-format to match style(9) 2026-06-02 23:57:25 +02:00
.editorconfig Add editorconfig 2024-04-05 08:39:02 +02:00
.gitignore gitignore: clean up stale entries and add missing generated files 2026-05-07 16:56:22 +02:00
.gitlab-ci.yml Add .gitlab-ci.yml 2018-09-07 10:33:17 -06:00
AUTHORS Add andrej in the authors 2015-01-17 21:29:58 +01:00
autogen.sh Convert to autosetup 2018-05-02 10:03:56 +02:00
configure Sync with latest bbuild 2026-06-02 23:57:25 +02:00
configure.def compat: restore humanize_number and strtonum for macOS 2026-08-20 18:30:03 +02:00
CONTRIBUTING.md Add initial CONTRIBUTING 2012-09-20 12:37:35 -05:00
COPYING Welcome to 2019 2019-01-02 10:44:25 +01:00
Doxyfile.in New Release 1.1.a1.20121222 2012-12-22 13:32:49 +00:00
FAQ.md Fix typos in source code 2026-04-29 15:52:25 +02:00
features.md Fix typos in source code 2026-04-29 15:52:25 +02:00
freebsd.cfg Style: Consider STAILQ_FOREACH as for, add braces around single lined if/for/while 2014-08-28 21:12:18 +02:00
Kyuafile build: replace autosetup by bbuild 2026-04-23 16:34:08 +02:00
Leak.suppress lsan: mark what I believe is a false positive as such 2026-05-25 10:44:47 +02:00
Makefile.in restore compat lib 2026-08-20 21:32:55 +02:00
NEWS 2.8.99.1 2026-08-10 11:58:28 +02:00
README.md README.md: Add missing space in pkg bootstrap [-f] 2024-12-04 16:03:01 +01:00
TODO.md Fix typos in source code 2026-04-29 15:52:25 +02:00
UndefinedBehaviour.suppress Directrly call the suppress file from the sourcetree and Kyua from the 2026-04-24 11:26:51 +02:00

pkg - a package manager for FreeBSD

  • Sourcehut FreeBSD: builds.sr.ht status
  • Sourcehut Alpine: builds.sr.ht status
  • Sourcehut Debian: builds.sr.ht status
  • Github Actions: build

Table of Contents:

libpkg

pkg is built on top of libpkg, a new library to interface with the package registration backends. It abstracts package management details such as registration, remote repositories, package creation, updating, etc.

pkg package format

The pkg package format is a tar archive that may be raw or compressed using one of the following algorithms: gz, bzip2, zstd, or xz. The default compression algorithm is zstd.

The tar archive itself is composed of two types of elements:

  • the special files at the beginning of the archive, starting with a "+"
  • the data.

Installing packages

pkg can install a package archive from the local disk, remote HTTP server or remote SSH server.

Pkg bootstrap

All supported versions of FreeBSD now contain /usr/sbin/pkg a.k.a pkg(7). This is a small placeholder that has just the minimum functionality required to install the real pkg(8).

To use, simply run any pkg(8) command line. pkg(7) will intercept the command, and if you confirm that is your intention, download the pkg(8) tarball, install pkg(8) from it, bootstrap the local package database and then proceed to run the command you originally requested.

More recent versions of pkg(7) understand pkg -N as a test to see if pkg(8) is installed without triggering the installation, and conversely, pkg bootstrap [-f] to install pkg(8) (or force it to be reinstalled) without performing any other actions.

Additional resources

To contact us, you can find us in the #pkg channel on Libera Chat IRC Network.

If you hit a bug when using pkg, you can always submit an issue in the pkg issue tracker.