RVM: Difference between revisions
Jump to navigation
Jump to search
Created page with 'Ruby Version Manager https://rvm.io// To create a new gemset: <pre> rvm ruby-1.9.3-p194@rails2314 --create </pre> To switch to a particular gemset: <pre> rvm gemset use rails23…' |
No edit summary |
||
(17 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== NOTE: RVM has been superseded by [[rbenv]]. Install that instead. == | |||
Ruby Version Manager | Ruby Version Manager | ||
https://rvm.io// | https://rvm.io// | ||
http://cheat.errtheblog.com/s/rvm/ | |||
== Install RVM == | |||
Follow the latest instructions here: https://rvm.io/rvm/install/ | |||
Choose the non-sudo "single user install" unless you have a good reason not to. | |||
May need to source <code>/etc/profile.d/rvm.sh</code> to get things working. | |||
Update RVM: | |||
<pre> | |||
rvm get stable | |||
</pre> | |||
== Install Ruby == | |||
First, fix any dependencies listed here: | |||
<pre> | |||
rvm requirements | |||
</pre> | |||
Show installed rubies: | |||
<pre> | |||
rvm list | |||
</pre> | |||
Show all available rubies: | |||
<pre> | |||
rvm list known | |||
</pre> | |||
Install: | |||
<pre> | |||
rvm install 1.9.3 # Latest known patch level | |||
rvm install 1.9.3 -j 3 # Parallel compile, set to # of CPU cores | |||
</pre> | |||
Remove a ruby: | |||
<pre> | |||
rvm remove 1.9.3 | |||
</pre> | |||
== Gemsets == | |||
<pre> | |||
rvm list gemsets # List rubies and gemsets | |||
rvm gemset list # List gemsets for current ruby | |||
</pre> | |||
Create a new gemset: | |||
<pre> | <pre> | ||
rvm ruby-1.9.3-p194@rails2314 --create | rvm ruby-1.9.3-p194@rails2314 --create | ||
</pre> | </pre> | ||
Switch to a particular gemset: | |||
<pre> | <pre> | ||
rvm gemset use rails2314 | rvm gemset use rails2314 | ||
</pre> | </pre> | ||
Now you can use <code>gem</code> to install the needed gems. | Now you can use <code>gem</code> or <code>bundle install</code> as usual to install the needed gems. | ||
Remove a gemset: | |||
<pre> | |||
rvm gemset use albinochipmunk | |||
rvm gemset delete albinochipmunk | |||
</pre> | |||
== Project Setup and Best Practices == | |||
https://rvm.io//rvm/best-practices/ | |||
https://rvm.io/workflow/rvmrc/ | |||
<pre> | |||
cd ~/projects/my_project/ | |||
rvm --rvmrc --create 1.9.1@my_project | |||
</pre> | |||
Now when you <code>cd</code> to the <code>my_project</code> directory, your ruby and gemset will change automatically: | |||
<pre> | |||
cd ~/projects/my_project | |||
[ruby-1.9.1-p243] (0) $ ruby -v | |||
ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-darwin10.2.0] | |||
[ruby-1.9.1-p243] (0) $ gem env gemdir | |||
/Users/wayne/.rvm/gems/ruby/1.9.1@my_project | |||
</pre> |
Latest revision as of 21:07, 7 October 2015
NOTE: RVM has been superseded by rbenv. Install that instead.
Ruby Version Manager
http://cheat.errtheblog.com/s/rvm/
Install RVM
Follow the latest instructions here: https://rvm.io/rvm/install/
Choose the non-sudo "single user install" unless you have a good reason not to.
May need to source /etc/profile.d/rvm.sh
to get things working.
Update RVM:
rvm get stable
Install Ruby
First, fix any dependencies listed here:
rvm requirements
Show installed rubies:
rvm list
Show all available rubies:
rvm list known
Install:
rvm install 1.9.3 # Latest known patch level rvm install 1.9.3 -j 3 # Parallel compile, set to # of CPU cores
Remove a ruby:
rvm remove 1.9.3
Gemsets
rvm list gemsets # List rubies and gemsets rvm gemset list # List gemsets for current ruby
Create a new gemset:
rvm ruby-1.9.3-p194@rails2314 --create
Switch to a particular gemset:
rvm gemset use rails2314
Now you can use gem
or bundle install
as usual to install the needed gems.
Remove a gemset:
rvm gemset use albinochipmunk rvm gemset delete albinochipmunk
Project Setup and Best Practices
https://rvm.io//rvm/best-practices/
https://rvm.io/workflow/rvmrc/
cd ~/projects/my_project/ rvm --rvmrc --create 1.9.1@my_project
Now when you cd
to the my_project
directory, your ruby and gemset will change automatically:
cd ~/projects/my_project [ruby-1.9.1-p243] (0) $ ruby -v ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-darwin10.2.0] [ruby-1.9.1-p243] (0) $ gem env gemdir /Users/wayne/.rvm/gems/ruby/1.9.1@my_project