Removing orphaned packages

What's the best way to remove orphaned packages on FreeBSD, i.e. dependencies of packages that have been uninstalled? I've tried pkg_rmleaves, pkg_cleanup, and pkg-orphan, but none of those three even detect orphaned packages properly. If, for instance, I install and uninstall porttools, that will leave sudo, ruby, and a bunch of other packages I don't need installed, of which pkg_rmleaves will only detect sudo.

Suppose a FreeBSD guru installs something huge, with lots of deps, and later he wants to remove it and all of its dependencies. How does he go about doing that?
 
Isn't that something portmaster -s should be able to do? Never tested it myself.

Code:
     -s  clean out stale ports that used to be depended on
 
Last edited:
I second pkg_cutleaves, but proceed with caution. Portsclean (with -C -DD and -L options) is also handy to clean out distfiles.
 
Last edited by a moderator:
Back
Top