Remove cached ruby gems in vendor/bundle path

In our RoR project I need to update the version for capybara-webkit gem that we’re using on our builds. I found that CI automatically caches the gems between builds. How can I remove/override the vendor/bundle path in order to remove/override the cached gems?

The easiest way to do this is to do a rebuild without cache—after doing such a build a new cache will be created in place of the older one. Please mind that the cache is per-branch, so you’ll need to do that for every branch that needs to be updated.


To Clean up old versions of installed gems use below command

gem cleanup [GEMNAME …]

The cleanup command removes old versions of gems from GEM_HOME that are not required to meet a dependency. If a gem is installed elsewhere in GEM_PATH the cleanup command won’t delete it.

If no gems are named all gems in GEM_HOME are cleaned.