Recommend
If you like my work with RVM, please recommend me *with a comment as to why you recommend me* on
Working With Rails – Thank You!
IRC
I am 'wayneeseguin' in #rvm on irc.freenode.net
If I do not respond right away, leave a message and I'll respond or leave you a memo when I am around.
Sponsors
$ rvm help # Documentation Index

Subshells

Using RVM it is very easily 'switch' to your default ruby or any other ruby while still maintaining all of the current shell's settings.

Let's explore a brief illustration of this:

$ rvm 1.8.6 # We are now using 1.8.6 for the current shell
$ ruby -v

ruby 1.8.6 (2009-08-04 patchlevel 383) [i686-darwin10.0.0]

We can spawn a subshell running a different ruby by prepending an RVM selector:

$ echo $(rvm 1.9.1 ; ruby -v)

ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]

What is the ruby of our original shell after running the above sub shell command?

$ ruby -v

ruby 1.8.6 (2009-08-04 patchlevel 383) [i686-darwin10.0.0]

Not changed at all! And we haven't had to mess with GEM_HOME, yay!

So we have 1.8.6p383 selected, what if we want to run something against the system's default ruby? Prepend another selector in a subshell!

$ echo $(rvm system ; ruby -v)

ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]

What is the ruby of our original shell after running the above sub shell?

$ ruby -v
ruby 1.8.6 (2009-08-04 patchlevel 383) [i686-darwin10.0.0]

Still the 1.8.6p383 we had selected to use.

Community Resources

RVM Documentation Index