Alright, so you’ve switched to using rvm but when you run cmd+r on a Ruby file in TextMate you’re still using your old system install of Ruby… Luckily it only takes a few easy steps to setup TextMate to use your rvm environment.
1) First make sure your install of TextMate if updated
Textmate -> Preferences -> Software Update -> Check Now
2) Next make sure all your bundles are up to date. The creator of rvm, Waynee Seguin, provides a small bash script to automate this process. You can check it out at this GitHub gist
3) Now get the rvm name of the Ruby version you want to use in TextMate. In my case I’m going to use my currently selected version “ruby-1.8.7-tv1_8_7_174″
rvm rubies
jruby-1.5.1 [ i386-java ]
ruby-1.8.7-tv1_8_7_173 [ i386 ]
=> ruby-1.8.7-tv1_8_7_174 [ i386 ]
ruby-1.9.1-tv1_9_1_378 [ i386 ]
ruby-1.9.2-head [ i386 ]
4) Then run the rvm command to wrap this ruby version for TextMate
5) Now set a TM_RUBY variable in your TextMate Preferences
Textmate -> Preferences -> Advanced -> Shell Variables
To the wrapper command generated by rvm for you, in my case it was found here:
/Users/cirish/.rvm/bin/textmate_ruby
6) Since TextMate will use it’s own builder, by removing it, we can use TM_RUBY as described above.
mv Builder.rb Builder.rb.backup
7) Last but not least, quit TextMate and re-open it to load these settings. You should now be all good
{ 10 comments }