When looking for a package to install on FreeBSD 11.2, such as the zsh shell:

pkg search zsh

…is the searching done against a local cache of packages information, or run over the internet against some repository server?

If the search is local, how can I update that local cache to be sure it is complete and has the latest versions?

  • Well, the manual says (my emphasis): "Search for the given pattern in the remote package repositories."
    – Kusalananda
    Nov 24 '18 at 8:53
  • ... if that is a cache of a remote repository or not, I'm not sure, but it may well be (as there is also a pkg update command for updating the cache).
    – Kusalananda
    Nov 24 '18 at 9:18

The FreeBSD pkg command maintains an SQLite3 database in /var/db/pkg/local.sqlite. This contains, amongst other things, downloaded package metadata that various pkg subcommands use, including pkg search.

pkg update is all that you need. Note that an update is implicit in various pkg subcommands, and actually has to be turned off with the -U option.

Note that there are subsystems that might be present on derivatives such as TrueOS that regularly update these caches.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.