# Alternative for ports-mgmt/pkg_cutleaves



## obsigna (Apr 10, 2014)

ports-mgmt/pkg_cutleaves does not work anymore with pkgng. Is there any alternative?


----------



## SirDice (Apr 10, 2014)

pkg-autoremove(8) may have some of its functionality.


----------



## vg (Apr 10, 2014)

obsigna said:
			
		

> ports-mgmt/pkg_cutleaves does not work anymore with pkgng. Is there any alternative?


ports-mgmt/pkg-rmleaf
ports-mgmt/pkg_cleanup
ports-mgmt/pkg_rmleaves


----------



## Carpetsmoker (Apr 10, 2014)

pkg_cutleaves works for pkg-ng if you set *WITH_PKGNG*...

This was added back in 2009 ... It should probably be updated to auto-detect this, or something, now that people are actually using pkg-ng...


----------



## obsigna (Apr 10, 2014)

SirDice said:
			
		

> pkg-autoremove(8) may have some of its functionality.



Many thanks for the hint. I guess, I will use this one for cleaning-up in the regular ports update sequence.



			
				vg said:
			
		

> obsigna said:
> 
> 
> 
> ...



I just installed and ran ports-mgmt/pkg-rmleaf and I found it a very nice replacement for ports-mgmt/pkg_cutleaves. Many thanks for the pointer.



			
				Carpetsmoker said:
			
		

> pkg_cutleaves works for pkg-ng if you set *WITH_PKGNG*...
> 
> This was added back in 2009 ... It should probably be updated to auto-detect this, or something, now that people are actually using pkg-ng...



Well, maybe in theory. In practice it shows me ports that are not installed anymore. I made the switch to pkgng one month ago, and of course I ran pkg2ng and set WITH_PKGNG=yes in /etc/make.conf, otherwise nothing would have worked.


----------



## kpa (Apr 10, 2014)

This simple query shows installed ports that nobody is depending on and are by definition leaf ports:

`pkg query -e "%#r=0" %n-%v`

I've noticed over time that pkg-autoremove(8) doesn't catch all leaf ports because for some reason ports that are pulled in as dependencies do not get flagged as automatic. The above query would catch those ports as well.


----------

