Using multiple versions of Ruby on the same host
RVM uses git so my first step was to install git with the Homebrew package manager. Homebrew is an increasingly popular alternative to MacPorts and Fink.
Note that you'll need to install Xcode first.
brew install git
Then I just followed the instructions available here.
source ~/.rvm/scripts/rvm
rvm install jruby,1.9.2-head
Here is what the output looks like:
info: Extracting jruby-bin-1.5.1 ...
info: Building Nailgun
info: Installing JRuby to /Users/rpark/.rvm/rubies/jruby-1.5.1
info: Importing initial gems...
info: Installing rake
info: Installing Ruby from source to: /Users/rpark/.rvm/rubies/ruby-1.9.2-head
info: Downloading source from http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_2.
info: Copying from repo to src path...
info: Running autoconf
info: Configuring ruby-1.9.2-head, this may take a while depending on your cpu(s)...
info: Compiling ruby-1.9.2-head, this may take a while depending on your cpu(s)...
info: Installing ruby-1.9.2-head
info: Installation of ruby-1.9.2-head is complete.
info: Updating rubygems for /Users/rpark/.rvm/gems/ruby-1.9.2-head@global
info: Updating rubygems for /Users/rpark/.rvm/gems/ruby-1.9.2-head
info: adjusting shebangs for ruby-1.9.2-head (gem irb erb ri rdoc testrb rake).
info: Importing initial gems...
The install is done. When you want to switch between different versions of ruby, just use the "rvm use" command:
11:10:23[~:15]$ which ruby
/Users/rpark/.rvm/rubies/ruby-1.9.2-head/bin/ruby
11:11:06[~:16]$ which gem
/Users/rpark/.rvm/rubies/ruby-1.9.2-head/bin/gem
rvm use jruby
11:10:01[~:11]$ which ruby
/Users/rpark/.rvm/rubies/jruby-1.5.1/bin/ruby
11:10:06[~:12]$ which gem
/Users/rpark/.rvm/rubies/jruby-1.5.1/bin/gem
Then add this to the end of ~/.profile:
RVM allows you to use different gemsets with each ruby version. One use case is working with Rails 2.3.3 and Rails 3.0. I didn't need this feature but it's nice to know it's there.
One final step is TextMate integration. This is described here.
Then run this script:
#!/usr/bin/env bash mkdir -p /Library/Application\ Support/TextMate/ sudo chown -R $(whoami) /Library/Application\ Support/TextMate cd /Library/Application\ Support/TextMate/ if [[ -d Bundles/.svn ]] ; then cd Bundles && svn up else if [[ -d Bundles ]] ; then mv Bundles Bundles.old fi svn co http://svn.textmate.org/trunk/Bundles fi exit 0
Open up Shell Variables in TextMate's Preferences -> Advanced
Final step: