Allan Espinosa

Faster and Reproducible Ruby Development Workflows

2015 May 16

If you’re doing development and cloning ruby based repositories, sometimes you want to cleanup your ruby gems spec or vendor/bundle directory. It is important to do a clean ‘bundle install’ so you won’t experience “it works on my machine” syndrome.

However, downloading gems from all the time is not the best experience in the world if you have a large Gemfile or is down itself.

Java developers have had this feature in maven with ‘proxy repositories’. Fortunately, you can do this same thing with Sonatype Nexus. Following the described documentation on proxy gem repositories1, Have something like this configured for

Repository ID: rubygems
Repository Name:
Repository Type: proxy
Repository Policy: undefined
Repository Format: rubygems
Contained in groups: 

Remote URL:

Likewise, you can have this in your ~/.gemrc


And ~/.bundle/config


Now, all gem downloads will be cached in nexus. The next time you do a ‘git clean -fdx && bundle install’, you don’t have to wait to download the Internet to get your Ruby builds working. This setup is useful especially for CI servers like Jenkins so that the next subsequent build times will be siginificantly less.