Is there an easy way to make a list of the dependencies a newly installed RPM package will install with yum?

Example: If you do yum install ruby then it will also install some rubygems.

But when I uninstall the ruby package I also want to get rid of the dependencies it installed.

So my first idea were to make a list of those new packages, and then do an rpm -e on those when I uninstall ruby.


How to make such list in an automated way?

Or is there an easier way then to have to manage text files with rpm package names?


2 Answers 2


yum keeps its own history, so you can find out when a package was installed or updated using its history.

For instance, yum history packages-info ruby will give you all the transactions involving ruby, where the oldest one is usually the one where the package was installed.

Transaction ID : 102
Begin time     : Thu Apr  3 17:15:17 2014
Package        : ruby-
State          : Install
Size           : 64,734
Build host     : buildvm-17.phx2.fedoraproject.org
Build time     : Thu Nov 28 06:01:20 2013
Packager       : Fedora Project
Vendor         : Fedora Project
License        : (Ruby or BSD) and Public Domain
URL            : http://ruby-lang.org/
Source RPM     : ruby-
Commit Time    : Mon Nov 25 07:00:00 2013
Committer      : V?t Ondruch <vondruch@redhat.com>
Reason         : user
Command Line   : install ruby rubygems
From repo      : updates
Installed by   : Michael Hampton <error>

This will give you the transaction ID, which you can then look up and find the dependencies which were installed, e.g. with yum history info <ID>.

Transaction ID : 102
Begin time     : Thu Apr  3 17:15:17 2014
Begin rpmdb    : 2336:55d492c6f5d091f328529861bdf95111264337f6
End time       :            17:15:20 2014 (3 seconds)
End rpmdb      : 2346:ccca040d610665c49a1ff6a11f787f8d5aa6790d
User           : Michael Hampton <error>
Return-Code    : Success
Command Line   : install ruby rubygems
Transaction performed with:
    Updated       rpm-4.11.2-2.fc20.x86_64                @updates/20
2 packages excluded due to repository priority protections
    Updated       yum-3.4.3-137.fc20.noarch               ?
    Updated       yum-metadata-parser-1.1.4-9.fc20.x86_64 @fedora/20
Packages Altered:
    Install     ruby-           @updates/20
    Dep-Install ruby-irb-       @updates/20
    Dep-Install ruby-libs-      @updates/20
    Dep-Install rubygem-bigdecimal-1.2.0-16.fc20.x86_64 @updates/20
    Dep-Install rubygem-io-console-0.4.2-16.fc20.x86_64 @updates/20
    Dep-Install rubygem-json-1.7.7-101.fc20.x86_64      @fedora/20
    Dep-Install rubygem-psych-2.0.0-16.fc20.x86_64      @updates/20
    Dep-Install rubygem-rdoc-4.0.1-2.fc20.noarch        @fedora/20
    Install     rubygems-2.1.11-115.fc20.noarch         @updates/20
    Dep-Install rubypick-1.1.1-1.fc20.noarch            @updates/20

If the package was just installed, and hasn't yet been updated, you can rollback the transaction with, e.g. yum history undo 102. This won't work if any of the packages has been updated since installation, though, as it matches name, version and release.

And if you really just installed the packages, you can skip everything else and run yum history undo last to rollback the most recent transaction.


You can remove them with yum autoremove.

  • 3
    When I tried this, it proposed to remove a few unnecessary packages, along with a whole bunch that I had explicitly installed and want. I would be very careful when using this. Apr 15, 2015 at 19:05
  • yum autoremove will remove all packages which were required for no longer available packages. If you want to keep them during yum autoremove, set them to manually installed first.
    – Mast
    Apr 16, 2015 at 12:49
  • "yum autoremove" doesn't work in centos 6.6 "No such command: autoremove. Please use /usr/bin/yum --help"
    – c4f4t0r
    Apr 21, 2015 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.