Created
April 29, 2011 06:20
-
-
Save nelsonenzo/947936 to your computer and use it in GitHub Desktop.
RVM Notes (Ruby Version Manager)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RVM Notes | |
Install a new version of ruby: | |
$ rvm install 1.9.2 | |
use that version: | |
$ rvm use 1.9.2 | |
check the version of ruby being used | |
$ ruby -v | |
find where that ruby version is stored | |
$ which ruby | |
Use the default system ruby typcially found here: /usr/bin/ruby | |
$ rvm system | |
list the existing versions of ruby that you have installed | |
$ rvm list | |
list all ruby versions that are available for install | |
$ rvm list known | |
Those are the version of ruby you are using. Now lets create and use gemsets. | |
list all existing gemsets | |
rvm gemset list | |
rvm gemset use rore | |
shortcut to change to a specific ruby and gemset combo: | |
rvm use 1.9.2-p180@rore | |
Create a gemset | |
(this gemset will use the current ruby version you declared above) | |
$ rvm gemset create rails300 | |
Gemset 'rails300' created. | |
Of course, your going to want to automatically switch to that gemset every time you navigate to the project directory, so create a file as such. | |
$ vi .rvmrc | |
insert this line of code | |
rvm use 1.9.2-p180@rore | |
save and exit file .rvmrc | |
***** workflow starts here ****** | |
Use 'which ruby' command above to find out what version of ruby you are currently running, then you can switch into the gemset you just created | |
$ which ruby | |
/Users/nelsonhernandez/.rvm/rubies/ruby-1.8.7-p299/bin/ruby | |
$ rvm 1.8.7-p299@rails300 | |
You are now in the ruby version 1.8.7-p299@rails300 gemspace. Your system gems are no longer available at this point. | |
Note from the rvm site: | |
* RVM gives you a separate gem directory for each and every Ruby version and gemset. * What this means is that gems will have to be explicitly installed for each revision and gemset. RVM provides you with a way to manage this process; see the ' RVM gem ' page. | |
So let's start by installing rails 3: | |
$ gem install rails |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#use a ruby version, usually 1.8.7 for rails 235 apps, 1.9.2-p180 for rails 3 apps | |
rvm use 1.9.2-p180 | |
rvm gemset create myProjectName | |
rvm gemset use 1.9.2-p180@myProjectName | |
#create the .rvmrc file in the project directory so that | |
vi .rvmrc | |
rvm use 1.9.2-p180@myProjectName | |
#install bundler gem, then install base project directory gems. | |
gem install bundler | |
bundle install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment