pkg-query(8) snippets

List all manually installed packages:

pkg query -e "%a==0" "%n"

Diff local and remote options

#!/usr/bin/env zsh
cd /tmp
for package in $(pkg query -a %n); do
  pkg query %Ok=%Ov $package > ${package}.local
  pkg rquery %Ok=%Ov $package > ${package}.remote
  diff -u ${package}.local ${package}.remote
  rm ${package}.local ${package}.remote
done
Use whatever you may find here at your own risk. This is my personal collection of things I feel may be useful to others but there are no guarantees, no warranties nor any form of support. See the FAQ for details.