# Cleaning up libraries and rebuilding dependencies.



## inurneck (Jan 13, 2010)

Once you have a box up and stable and after a while of using it, what are some commands, man pages, and resources you can all point me to in order to clean up the filesystem of lib and config residue in general, like libraries and files that arent in use anymore and rebuild just the ones that are needed. Basically I am done with this box I got almost everything I want installed but I believe in particular > -gnome- < installed a bunch of bloat that I don't really need. It made my organized /etc and /usr/local/etc look as cluttered as someones C:\WINDOWS and it did it in lightspeed. Although extremely rounded off I don't have an awful lot of experience with this particular field of commands example 'ld' and 'ldconfig' and id like to learn more about it. I am not afraid of breaking gnome either so don't worry about that. I have had just about enough of it and if it fell off of my electronic planet and lied their bleeding i'd walk by without tossing it a band-aid. If someone even starts talking to me about gnome again in my life I am going to run away with combat quickness. :\


----------



## SirDice (Jan 13, 2010)

For the base OS it's simple.

```
cd /usr/src
make delete-old
make delete-old-libs
```

As for the ports, it's probably the easiest to do by having a look at the output of `# portmaster -l`. You will need to install ports-mgmt/portmaster. There's also ports-mgmt/pkg_cutleaves which may come in handy.


----------



## fronclynne (Jan 13, 2010)

For trimming out _some_ of the cruft and kipple that seems to go along with upgrading or deinstalling from ports tree, ports-mgmt/portupgrade has the /usr/local/sbin/portsclean tool.  Note that from time to time, upgrades to ruby, bdb, or portupgrade itself may render portupgrade crippled or useless.  I keep ports-mgmt/portmaster in mind and on hand, since it has the advantage of depending solely upon /bin/sh.

Another tactic that seems to be used with some frequency is to make a list of the leaf ports you actually need (or a meta-port, if you're really into that) and then deleting everything under /usr/local/ and rebuilding.  Oh, might want to save any modified config files under /usr/local/etc/ . . .


----------

