Last Updated: February 25, 2016
·
3.359K
· karunamon

Maintaining a local mirror of Rubygems.org

If you're in anything resembling a large enterprise, you probably have (overly) restrictive firewalls and other shenanigans to jump through in order to do something simple as update your OS or install a gem. This necessitates setting up local mirrors on approved servers for various things.

If you've ever tried doing a mirror of Rubygems, you know that this:

A) Takes up a ton of disk

and

B) Doesn't work right.

It doesn't work right because the mainline version of the mirror gem attempts to build the index files itself - and considering we're talking hundreds of thousands of gems (totaling roughly 200ish gigabytes), you quickly run into Ruby's own limits on memory and other system resources.

The fix for this is to use a patched version of rubygems-mirror that simply grabs the provided index files.

https://github.com/huacnlee/rubygems-mirror

Set this up according to instructions and you'll have your mirror a few hours later :)