Gemsets and .rvmrc – Ruby Gem Management Made Easy

RVM is a tool that automatically manage your ruby versions. You can make 1.8.7 and 1.9.2 live together without issues. The installation process is a bit lacking – bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) is not really a command that looks safe at first sight. Blindly executing code from the Internet is not for the faint of heart but yep, rvm is really that useful.

I especially love gemsets. They allow you to completely separate your various development environments for each of your projects. Gem conflicts are a lot less common.

You can even automatically change to a gemset for each of your project by using the an .rvmrc file. I use ruby 1.9.2 by default but I have one project that uses ruby 1.8.7. I use a separate gemset called ‘mygemset’.

# create the gemset if it does not exist
rvm_gemset_create_on_use_flag=1
# switch to default ruby version when exiting directory
rvm_project_rvmrc_default=1
# use ruby 1.8.7 with a specific gemset
rvm ruby-1.8.7-p302@mygemset

Pretty neat. Since this file is committed, it also means everyone on the team has the same setup.

One thought on “Gemsets and .rvmrc – Ruby Gem Management Made Easy”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>