VOOZH about

URL: http://rvm.io/workflow/subshells

⇱ RVM: Ruby Version Manager - RVM in Subshells


👁 RVM Logo
Support
RVM is maintained by community of volunteers, report issues to RVM issues tracker.
If you can help or wish to become one of the maintainers - just start helping. You can find more RVM related projects at RVM Github organization.
Donation
Love RVM? Help us maintain RVM, a donation can help with it. Want to help in other way, want to be a sponsor?
contact: Michal Papis
Sponsors
👁 Fastly
Carbon Ads
Documentation  >  Workflow  >  Subshells

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 | RVM Blog
RVM Interpreters Rubies
Gemsets Set Actions Workflow Deployment
Integration
Packages Presentations Help & Support Quality Assurance Development Credits
∞ Copyright © 2009-2011 Wayne E. Seguin © 2011-2017 Michal Papis © 2016-2017 Piotr Kuczynski ∞ Built with Nanoc ∞ Cached by Fastly ∞ Tested by Travis CI