Skip to content
Find cruft on pkgng systems like FreeBSD
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information. README: More tweaks Aug 15, 2018
pkg-cruft Rename "unpackaged" to "files", and add a "dirs" command. Aug 15, 2018
pkg-cruft.8 Update man page Aug 15, 2018


A small Ruby script for helping deal with cruft on pkgng (FreeBSD etc) systems.


  • pkgng (tested on FreeBSD 11.2)
  • procstat (for checkrestart)
  • Ruby (tested on 2.4.4 and 2.5.1); no gems used or needed.


% pkg-cruft [ help | defunct | files | dirs | libcheck | checkrestart ]



Check for packaged files that link against unpackaged, compat, or obsolete libraries, ignoring files specified in env IGNORE_LLD.

% pkg-cruft libcheck
compat10x-amd64-10.3.1003000.20170608: /usr/local/lib/compat/ missing library
compat10x-amd64-10.3.1003000.20170608: /usr/local/lib32/compat/ missing library


Check for running processes that may require restarting due to replaced executables or libraries. Named for the similar Linux command.

Run as root to check all running processes. False-positives are possible.

# pkg-cruft checkrestart
[MISSING EXECUTABLE] (tmux-2.7)? running as 17319 (tmux)
[MISSING EXECUTABLE] (zsh-5.5.1)? running as 20115 (zsh)
[MISSING EXECUTABLE] (weechat-2.2)? running as 36747 (weechat)
/usr/local/bin/mosh-server (mosh-1.3.2_4) running as 53815 (mosh-server)


List files in PREFIX that are not provided by any installed package, ignoring files specified in env IGNORE_UNPACKAGED.

# pkg-cruft files


List directories in PREFIX that do not contain any packaged files, ignoring any specified in IGNORE_UNPACKAGED.

# pkg-cruft dirs


List local packages that are not available from remote repositories.

% pkg-cruft defunct


Configuration is via environment variables:

Variable Default Description
PREFIX /usr/local Installation prefix
CONCURRENCY 16 Workers to use for libcheck
IGNORE_UNPACKAGED www:poudriere:varnish :-separated patterns to ignore in files and dirs, anchored on PREFIX
IGNORE_LLD go/src/*/testdata/* :-separated patterns to ignore in libcheck
You can’t perform that action at this time.