autoremove unneeded ports

Hi, have tried searching google/forum posts for a command to "auto remove" any un-needed ports that i have installed. In a similar fashion to `apt-get autoremove` on debian systems (remove installed packages/libs left behind, after something has been removed).

Either i'm looking at the wrong man pages, or can't seem to find anything.

I have so far looked into `pkg_delete`, `pkg_deinstall` and `portsclean`
But i am not too sure how to autodetect packages that don't need to be on my system.

What are my options?
 
It's tricky for the system to tell if a port that nothing depends on is one you might want to keep installed. Like, say, Firefox.
 
There is sysutils/pkg_cutleaves. But be careful with it since it may also remove all the "top-level" ports, i.e. your applications, since no other port depends on them. If I am not mistaken, you may pass it an exception list file where you can include all your applications.
 
Beastie said:
If I am not mistaken, you may pass it an exception list file where you can include all your applications.

# pkg_cutleaves -x

/usr/local/etc/pkg_leaves.exclude
Code:
apache
vi

Will exclude all ports starting with apache or vi, apache22 apache13 vi and vim for example.
 
Back
Top