# Dependency cleanup



## dbi (May 11, 2009)

How to clean unused dependencies?

Example:

I install KDE via sysinstall. It pulls automatically all the packages KDE needs to run. After a while I decide to remove KDE. How am I supposed to remove the dependencies sysinstall had pulled for KDE?


----------



## graudeejs (May 11, 2009)

ports-mgmt/pkg_cutleaves


----------



## dbi (May 12, 2009)

Thanks!


----------



## lbl (May 13, 2009)

*portmaster -l*

I normaly use portmaster for this.

its found under /usr/ports/ports-mgmt/portmaster

```
[root@virt0 ~]# portmaster -l
===>>> Root ports (No dependencies, not depended on)
===>>> libpcap-1.0.0
===>>> libtool-1.5.26
===>>> portmaster-2.7
===>>> tcpreplay-3.4.1
===>>> 4 root ports

===>>> Trunk ports (No dependencies, are depended on)
===>>> libiconv-1.11_1
===>>> m4-1.4.12,1
===>>> 2 trunk ports

===>>> Branch ports (Have dependencies, are depended on)
===>>> gettext-0.17_1
===>>> 1 branch ports

===>>> Leaf ports (Have dependencies, not depended on)
===>>> bash-4.0.17
===>>> bison-2.4.1,1
===>>> gmake-3.81_3
===>>> 3 leaf ports

===>>> 10 total installed ports
[root@virt0 ~]# pkg_delete bison-2.4.1,1
[root@virt0 ~]# pkg_delete gmake-3.81_3
[root@virt0 ~]# pkg_delete libtool-1.5.26
[root@virt0 ~]# pkg_delete libpcap-1.0.0
[root@virt0 ~]# portmaster -l
===>>> Root ports (No dependencies, not depended on)
===>>> m4-1.4.12,1
===>>> portmaster-2.7
===>>> tcpreplay-3.4.1
===>>> 3 root ports

===>>> Trunk ports (No dependencies, are depended on)
===>>> libiconv-1.11_1
===>>> 1 trunk ports

===>>> Branch ports (Have dependencies, are depended on)
===>>> gettext-0.17_1
===>>> 1 branch ports

===>>> Leaf ports (Have dependencies, not depended on)
===>>> bash-4.0.17
===>>> 1 leaf ports

===>>> 6 total installed ports
[root@virt0 ~]# pkg_delete m4-1.4.12,1
[root@virt0 ~]#
```

Then you can just pkg_delete the "Leaf" and "Root" ports you dont use.

Its an easy way to keep track on stuff.

/lbl


----------

