in this post: about getting software and managing packages and ports on FreeBSD 10. The first post on this series is available
seems to be the defacto standard way to manage and install binary FreeBSD packages. Its interface is pretty tradicional; users of Ruby Gems, node’s npm and stuff should not have trouble using it. For example,
pkg install bash
was one of the first things I tried. The second one was
pkg install emacs
, but this has failed. Then a simple
pkg search emacs
would reveal that the correct name should be
. I opted for the last one. Other simple commands involve
. For starters, this is enough. A feature that I love in any package manager is the reverse query, where you enter a file in your system and then get the package that installed it.
does that. Another one which helps learning how files are organized within a package is listing all the files inside a package.
pkg info -l
does that. I like to introspect quickly what are the commands of a package manager by inspecting the source code of pacapt
. A remarkable feature is
, which shows the user any known vulnerabilities. I’ve never seen this before – Linux distributions simply update their packages, that’s the way of being safe, so I’m not sure of the usefulness of audit. Finally, to locally install a .txz package you use
pkg add /path/to/pkg
. All the commands I listed here should be enough to get your feet wet. What’s next? Let’s try to remove a dependent package. For example,
pkg info -d emacs-nox11
shows me that emacs depends on libxml2. So, let’s try to remove this dependency?
pkg remove libxml2
gives me an error, telling me that it depends on emacs. Nice. If I want to forcefully and cleanly remove it, I should enter
pkg remove -R
. This would remove emacs as well. As the quantity of binary packages available, I’ve found out that there are 24k packages. For comparison, the debian base has about 40k and the Arch Linux one 7k (if you add the Arch User Repository, this list gets bigger than 50k). So I could say that the quantity is reasonable. While I don’t expect to find everything, this base should cover standard use cases. What about out-of-dateness of those packages? You know, Debian, CentOS and these “stable server family” are slow about updating their packages; I’ve made quick tests by searching for nodejs, nginx, apache, mongodb. I’m impressed, they were all up-to-date. Even calibre (which is changing faster nowadays) was up-to-date (in the 1.43 version). I used this
to learn about pkg, plus pkg itself (it looks well documented). It is worth noting that this pkg utility has been introduced in this tenth release of FreeBSD. Before it, it looks like there were a collection of programs responsible for package management, such as pkg_add, portmaster, something along these lines.