GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS

Written by thoughtbot

PSA: Do not use system Ruby

OS X Mavericks may ship with Ruby 2.0. Cool, right? Don’t touch it.

Why eschew system Ruby?

The root problem is not with using a pre-installed Ruby per se, but with not using a Ruby version manager.

Problem: Gem Dependencies

PC users will remember DLL hell. Ruby developers have dealt with similar problems.

Problems regarding gem dependencies are introduced after upgrading sudo-installed gems. At this point you are left to shepherd the gems and dependencies of Rubygems on your system’s install. Plain vanilla dependency management of Rubygems is not for the faint of heart, this is why Bundler exists. It could be argued that Bundler singlehandedly saved the Ruby ecosystem from this issue. If you don’t plan to use Bundler to manage your Ruby-based app dependencies you will shoot yourself in the foot.

For your Ruby-centric applications use Bundler.

Problem: Upgrading Ruby

If you’ve run into issues with Ruby and decided to upgrade your system’s runtime you stand the chance of breaking tools that may depend on your old install. Tools like VIM depend on what it was compiled against. Making that update could very well impact the tools that have been built against it.

Choose an Alternative

Ruby “version managers” will install Ruby and configure your environment for their use.

System Ruby and Rubygems - don’t use them

The amount of uncertainty is too great to build your working environment around the default Ruby-related tools. For the experienced Ruby developer this is nothing new. For the beginner or novice working with Ruby for the first time this might not be quite so obvious. Consider how many gems still recommend using sudo gem install in their instructions? If your project is one of them, please update it to not do so.

Special thanks to Pat, Gabe, Joël and Dan for contributing to this post.