The first, default, easiest way to set up ruby is to just download ruby; compile it, and run it. It probably comes with your mac and you can easily install it with Ubuntu's package manager or any other linux distro that you're doing.
However, there are these tools called “ruby version managers”, and RVM is named exactly that. RBENV is another one. These tools allow you to run multiple versions of ruby and keep gems separated out in your different applications.
Well, you might have an application that’s older; and you need to still work on it occasionally, that only works in ruby 1.8.7. Well, the latest version of ruby at this time is ruby 2.1.2. So in your other projects you’re probably working with 2.1; and you need to be able to switch between these.
RVM, and RBENV, and these other tools allow you to switch between those ruby versions and automatically detect that per application. So your applications can define which version of ruby they use and thats it; you don't need to do anything more.
Well RVM is a very full featured version manager; so if you've never done anything with ruby before it might be good to use RVM because there’s so many things that it helps you with.
RBENV however is designed for people that are a little but more familiar with it and want a lightweight version manager. RBENV will set itself up very lightweight. It will add itself to your environment variable called
$PATH. Then when you type ruby it will look to your path, find the ruby executable, and then go from there.
RVM will actually take and override some of your environment stuff as well; and go a little bit deeper. It will upgrade the cd command; and several other commands. It also provides these older things called gem sets that allow you to say, “we can name these sets of gems for each application.”
Gem sets are not really useful anymore because we have a tool called BUNDLER. And BUNDLER; as you'll see, has been added in more recent versions of rails as the default. Your gem file is the one that BUNDLER handles, and it keeps all of your gems separated and up to date. You don't have to worry about using gem sets and theres fewer reasons to use RVM anymore unless you’re brand new.
I recommend using RBENV because its lightweight so you can spend your time learning how it works because its very simple to use.
So if you're brand new you may check out RVM. However, I recommend RBENV for everyone if you're up to the task of learning it.
Its very rare that you'll actually go to download ruby and compile it from source; because you're only allowed one version of ruby, and generally developers tend to work on a bunch of different projects and want to install the latest version of ruby. These tools allow you to do that; but if you do it yourself then you'll have to constantly be messing with things; and thats not super fun.
Thats a really quick rundown of version managers and how they differ from each other. If you're interested check out RBENV and enjoy.
Transcript written by Timothy Ashby
Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.