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
{ 9 comments… read them below or add one }
Awesome!! Thanks a lot for sharing
note:
This might symptomatic of a newer version of TextMate as this post is a bit stale but for me, step 6 was not necessary.
I simply built the rvm wrapper, added the TM_RUBY variable and restarted textmate.
On apple+r i see ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0] so it appears all is good!
thanks for the post.
Thanks for the tip, works great!
I think this issue might be updated on the rvm site.
http://beginrescueend.com/integration/textmate/
I just set up the rvm-auto-ruby approach, and now my run command looks at the project .rvmrc file and executes that version of ruby, if no .rvmrc it defaults to the rvm default. Beautiful.
You’re correct, this post is pretty old. I need to update it to use the rvm-auto-ruby approach.
a bit offtopic, but before i wrote this http://uberfork.com/post/12280974742/integrate-rbenv-with-textmate i also looked here to find some answers how to setup textmate to use rbenv
Works as a charm
Thank you!
Sweet. Worked like a charm
Thanks for showing this technique. I automated the “rvm wrapper” step with after_use_textmate hook, which should soon be shipped with rvm.
gist: https://gist.github.com/mwlang/5681232
rvm pull request: https://github.com/wayneeseguin/rvm/pull/1931
{ 1 trackback }