Rbenv, rvm, chruby? Which do you use and why?

They seem to all do exactly the same, all using the .ruby-version to get the current Ruby version for your project.

Which do you use and why?

1 Like

RVM. I did try rbenv, but I just couldn’t get it to work on my server so gave up and reverted to rvm :smiley:

Have never used chruby - anyone got any experience of it?

I’ve used chruby and ruby-install for a while now. Works great!

2 Likes

How is your setup? Do you use chruby for production as well?

1 Like

I just brew chruby and ruby-install. Production is ops works recipes, which I believe just install distro packages for ruby.

3 Likes

Still use RVM. Used to use gemsets for dependency management until not so long ago, but its Bundler now as all the cool kids use it.

1 Like

Yeah, that’s what I mean by them all being the same. They all use Bundler to handle the gemsets.

1 Like

I use RVM. It works well. Easy installation with ā€˜\curl -sSL https://get.rvm.io | bash -s stable’ and if you mess up your Gemset, or RVM environment, it’s as easy as removing ~/.rvm and re-installing.

I haven’t tried rbenv but my father did install it and had to upgrade his Linux distro for some required library.

1 Like

I like and use rvm, but the other folks on the company use rbenv instead…

1 Like

RVM on my dev which is a Mac
Pure installation on server (docker image)

1 Like

We use a base image with just rbenv and then install the proper Ruby in another ā€œbase imageā€ which we can then inherit from for our apps. We don’t run the same Ruby on all apps, but this gives some maintainability for the DevOps. :smirk:

2 Likes

I use rvm, but it is awfully persnickity… always wants to be first in the PATH (that warning can be turned off, thank goodness), and it often nags me about it being "not a function.’ The next time it gives me fits, I’m going to try rbenv instead and see if it’s better.

2 Likes

I use chruby and compile the ruby versions I need into ~/.rubies
Altough I think I could use ruby-install I somehow prefer to compile them by source :smile:

In addition to chruby I use gem_home to get the feeling of gemsets.
Each project I do has a .gem/ folder where only the gems for this specific project are installed.

2 Likes

install rbenv

git clone git://github.com/sstephenson/rbenv.git ~/.rbenv

mkdir -p ~/.rbenv/plugins
cd !$
git clone git://github.com/sstephenson/ruby-build.git
git clone git://github.com/jamis/rbenv-gemset.git
git clone git://github.com/dcarley/rbenv-sudo.git

instert this to your ~/.bashrc and your ~/.profile

export PATH=ā€œ$HOME/.rbenv/bin:$PATHā€
eval ā€œ$(rbenv init -)ā€

required packages to build ruby

sudo apt-get install build-essential libssl-dev libxml2-dev libxslt1-dev libreadline-dev

installation of a special ruby version via ruby-build

rbenv install 2.2.2

define the global version

rbenv global 2.2.2

define a specific version and gemset

echo ā€œ2.2ā€ > .ruby-version

define a specific global gemset

echo ā€œmy_projectā€ > .ruby-gemset

define a specific local gemset placed on the same directory as .ruby-gemset file

echo ā€œ.my_projectā€ > .ruby-gemset

Now you can relogin or just source your ~/.bashrc

. ~/.bashrc

Sometimes you have to call rbenv rehash after bundle install

3 Likes

Thanks @0xCCD. I don’t remember exactly what the problem was now (it was a couple of years ago) just that I spent hours trying to get it to work but it wasn’t having any of it. It was a new server and I had used RVM on the previous one, so just gave up and went back to RVM.

I use rbenv.

Got annoyed with RVM, so just imploded it. =)

1 Like

I use RVM. I haven’t really tried any of the others because RVM is doing just fine for me :smile:

2 Likes

chruby seems to be the simplest of them all. Have been using them for over a week, it feels good.

5 Likes

Well I’m moving the sites to a new server and am wondering about which to use…

Slanting towards Chruby atm…

Endorsements

yeah chruby is nice, does the limited thing of switching really good, the only hope it never grows
– Michal Papis of RVM

I just looooove chruby For the first time I’m in total control of all aspects of my Ruby installation.
– Marius Mathiesen

Written by Postmodern, it’s basically the simplest possible thing that can work.
– Steve Klabnik

So far, I’m a huge fan. The tool does what it advertises exactly and simply. The small feature-set is also exactly and only the features I need.
– Patrick Brisbin

I wrote ruby-version; however, chruby is already what ruby-version wanted to be. I’ve deprecated ruby-version in favor of chruby.
– Wil Moore III

This is a good write-up http://kgrz.io/2014/02/13/Programmers-guide-to-choosing-ruby-version-manager.html leaning even more towards chruby now…

3 Likes