Yum – How to Remove Unused Packages

rpmyum

I have installed some rpm package on my Fedora 17. Some packages had a lot of dependencies.
I have removed some packages but I forgot remove unused dependencies with yum remove.

How can I do that now?

Best Answer

It's not easy. How do you differentiate between "a file that was required by something I have since removed" from "a file that is not required by anything else that I really want"?

You can use the package-cleanup command from the yum-utils package to list "leaf nodes" in your package dependency graph. These are packages that can be removed without affecting anything else:

$ package-cleanup --leaves

This will produce a list of "libraries" on which nothing else depends. In most cases you can safely remove these packages. If you add --all to the command line:

$ package-cleanup --leaves --all

You'll get packages that aren't considered libraries, also, but this list is going to be so long that it probably won't be useful.

Related Question