© 2014 Warren Block
Last updated 2014-12-26
The new package management system on FreeBSD.
pkgis the preferred name now.
Should I use
Yes. In fact, if you want to keep using binary packages or ports built after September 2014, it is required.
How can I tell which package management system is installed?
FreeBSD 10.1 and later do not include the old package management system. On earlier systems, running
pkg infoshows a list of packages if
pkghas been installed, or offers to install the new package management system if it is not present.
If I switch, can ports still be used?
Of course. When a port is compiled, it actually creates a package. The package is then installed and managed by the package management system. A binary package is the same, it has just been compiled on a different computer.
How can I switch to
portmaster ports-mgmt/pkgto install the port.
pkg2ngto read the old package database and write the new one. Do that conversion only once.
After switching to
pkg, can the old
pkg_*commands still be used?
No, do not use the old pkg_* commands any more. The database they use is likely to be outdated or not even present. The new
pkgcommands are similar, but the
pkgcommand is followed by a space and a subcommand, like
Can the old package database files be removed?
pkgdatabase is a SQLite file called local.sqlite in /var/db/pkg/. The old package database consisted of a subdirectory for each package in this same directory. All of those old subdirectories can be deleted, although
portmasteruses them to keep track of things and will recreate them.
What is Poudriere?
An automated system that builds binary packages out of ports. This is what the FreeBSD cluster systems use to build binary packages. It can also be used by individuals to build their own customized binary packages. If several machines need the same applications, one system can be used to build those binary packages from ports, and then all of them can quickly install the resulting binary packages.
Is Poudriere required to build from ports?
No. The standard
make build/install/cleanports commands work fine. Poudriere just makes it possible to build binary packages from ports in bulk.
Should I use ports or binary packages?
It depends. Binary packages are convenient because they require no compiling. However, they do not allow customized options. For an example, consider the many options of the www/nginx port. In a binary package, these are set to defaults and cannot be changed. Ports must be compiled, but can be customized and optimized for an individual system or use. If you support multiple machines, Poudriere makes it possible to build customized binary packages for them, requiring no build time on the target system.
When will FreeBSD drop ports altogether?
Binary packages are created from ports. So the answer to this question is "probably never". However, a computer that uses only binary packages does not need a copy of the ports tree.