DEV Community

Lucas Barret
Lucas Barret

Posted on

State of Ruby : What version manager to use

I have asked on Twitter what was your favorite version manager for Ruby.

The clear leader was Rbenv, ASDF, which was most of the comment for the last response; then we have RVM, but I will not consider it for the rest of this post because it is pretty obscure how it works :).

Let's understand the critical difference between those and help you make some choices for your Ruby Version manager.

Community

Leaderboard :

    1.Rbenv
    2.ASDF
    3.Chruby
Enter fullscreen mode Exit fullscreen mode

First, the Tweet shows that Rbenv is a great winner for the Ruby community. But it seems mainly because it is the goto solution.

Nevertheless, this is a great thing because if you have an issue. It is more likely that you are one of many to have it.

Versatility

In terms of versatility, here is the leaderboard :

    1. ASDF
    2. Rbenv 
    3. ChRuby
Enter fullscreen mode Exit fullscreen mode

Indeed, ASDF enables you to manage your ruby version and supports many other languages and tools like nodejs. Moreover, you can add a plugin to it.

Rbenv is also versatile, and you can add plugins; nevertheless, as its name suggests, you can only manage the ruby version. Rbenv and ASDF both use the same underlying gem, which is ruby-build.

ChRuby is not extensible, and you can only manage Ruby with it. But it comes with ruby-mac, an excellent tool for installing ruby quickly on Mac.

Speed

1. ChRuby
2. Rbenv
3. ASDF
Enter fullscreen mode Exit fullscreen mode

Why?

Rbenv and Asdf are Shim. They act like a proxy for every call to Ruby. Inevitably, they are slower.
Chruby does not provide that, and you need to use chruby-exec if you want to use the version managed by chruby.

Misc

Moreover, both Rbenv and ASDF use ruby-build to compile and install ruby. Whereas chruby can use both ruby-build and ruby-install for new rubies installation.

In addition, chruby is really simple to install if you are on Mac thanks to ruby-mac utility tool.

And the winner is ?

There is no such thing as a better version manager. It all depends on what you want to do.

If you want a lightweight and quick version manager, use chruby.

You have several choices if you want something with more extensibility and do not care about speed :

  • ASDF if you want to manage several other language than Ruby.

  • Rbenv if you need a versatile version manager that manages only ruby

There is this good resource that also talk about different ruby version manager from the Rbenv repository. With some links to benchmarks of ASDF and Rbenv.

Top comments (6)

Collapse
 
georgy5 profile image
Karl Keller

Very good article on version managers for Ruby.

After coming across ASDF in 2021 I'm loving it. On my latest install I'm managing Ruby, Node, Erlang and Elixir as well as PostgreSQL versions with it.
...also Rust for Ruby 3.2 with YJIT

Collapse
 
yet_anotherdev profile image
Lucas Barret

Thanks ! ASDF seems indeed to be really cool for the versatility :)

Collapse
 
poudelprakash profile image
Prakash

asdf all the way!

Collapse
 
louisagreg_knobbyws_6e27f profile image
LouisaGreg KnobbyWs

Thanks. One of the first reviews I've read the fairly rates chruby. Fast and simple. Most reviewers seem to push the cooler, more complex ADSF and rbenv without really saying many may not need it.

Collapse
 
yet_anotherdev profile image
Lucas Barret

Simplicity is a cool feature, often underrated :)

Collapse
 
jdxcode profile image
Jeff Dickey

choose rtx and you'll get performance (written in rust, can be shim-less) as well as extensibility since it uses asdf plugins.