Buckle Up, There’s a New Gem Server in Town: gem.coop

Assuming you haven’t been living under a rock these past few weeks, the Ruby community has been embroiled in quite a bit of drama. I won’t recap it here…there are plenty of other sources to go (Joel Drapper for one), and I also have my own pointed take on the matter on my personal blog. But here on Fullstack Ruby I like to maintain a positive, can-do attitude, and to that end, let’s talk about some very exciting developments!

Most Rubyists are familiar with rubygems.org and the reason that you see source "https://rubygems.org" at the top of every Gemfile is so Bundler can download and install gems from the rubygems server.

What I, and I suspect most of you, never considered is that source could be pointed at, well, anything. In fact, you can have multiple sources as well, and you can even write blocks to install groups of gems from different sources including git repos. (TIL 👀)

So Bundler is very flexible in this regard, as is the gem command (more on that in a moment). Which is why this news matters: The Gem Cooperative has announced a new community-minded gem server is now available, currently mirroring all the gems from rubygems. Martin Emde says that “all Ruby developers are welcome to switch to using this new server immediately.”

And here’s how you do it. Edit your project’s Gemfile and replace the source line at the top with this:

source "https://gem.coop"

Now you can bundle install and bundle update and support this new community effort.

Who is behind The Gem Cooperative, you may ask? Basically it’s all those folks who had previously been working on rubygems before they were unceremoniously kicked out of Ruby Central during the takeover. Ouch. From gem.coop, they are:

And Mike McQuaid of Homebrew fame is also helping out with establishing governance for the project (and some technical advisory from the looks of things).

Work is currently underway on an updated version of Bundler that will support namespaces, and once that happens and gem.coop is updated to support gem pushes, we could see folks decide to publish new/updated gems only to gem.coop under new namespaces. This is all in service of moving away from Ruby Central as a single (and very problematic) point of failure.

All right, so updating your Gemfile is easy enough, but what about when you need to install new gems from scratch using the gem command? You will use gem sources for that. First, you can get a list of which sources you currently use by running gem sources --list. Typically you’ll just see the rubygems server listed. To add gem.coop, run:

gem sources --add https://gem.coop

and to remove rubygems, run:

gem sources --remove https://rubygems.org/

You can verify when you install a new gem which server is used by including the -V flag, e.g.:

gem install solargraph -V

Otherwise just use gem as per usual.

With news like this and the previous round of news regarding rv which is an attempt to create next-generation unified Ruby tooling (install Ruby, install dependencies, run app commands, create new gems, etc.), I think we may be on the cusp of a big leap forward for the language both in terms of technical prowess as well as acceptable forms of community governance. small red gem symbolizing the Ruby language

Skip to content