On Tue, Aug 04, 2009 at 11:11:17AM -0400, Luis Useche wrote: > Hello Guys, > > I was wondering if there is some tool that delete the packages > specified along with their "deletable" dependencies. Deletable means > packages that pkg_add added automatically (as dependencies of the > installed one) and are not dependency of another package. This will > ensure (in most of the cases) that you don't end up with a system with > unnecessary packages. > > I couldn't find in pkg_delete(1) any option that implements the > previous semantic.
Here's what I do (it's kinda silly): $ /bin/ls -1a /var/db/pkg/ | grep -Ev "^(\.|\.\.)$" > plist $ vi plist # remove pkgs I want to KEEP (vim, ...) $ for f in `cat plist`; do sudo pkg_delete $f; done $ for f in `cat plist`; do sudo pkg_delete $f; done $ for f in `cat plist`; do sudo pkg_delete $f; done $ for f in `cat plist`; do sudo pkg_delete $f; done Keep running that until nothing gets removed. It's a hack, but it does what I want. If something in plist is a dependency, it won't get removed. -ME