Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the Ruby version Textmate uses?

EDIT: I found a solution for this, you can read it in my answer bellow.

I am using Textmate on Snow Leopard, and have installed ruby 1.9. The problem is that for some reason Textmate uses Ruby 1.8.2

But when I use IRB, or run ruby scripts for the shell, the proper version of Ruby (1.9) is used.

How can I configure Textmate so it uses 1.9.2?

I've been googling and apparently you have to use the T_RUBY variable and textmate, and set some environment variable in OSX, but so far none of the methods I've found works for me.

Could someone give a step by step solution to this problem?

Update: I already tried adding the ruby binary path to TM_RUBY in textmate, and I get this error:

> Can't find
> “/Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> /Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> /Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> ” on PATH. Theme: The current PATH is:
> /usr/bin /bin /usr/sbin /sbin Please
> add the directory containing
> “/Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> /Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> /Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> ” to PATH in TextMate's Shell
> Variables preferences.
like image 430
agente_secreto Avatar asked Jul 01 '11 09:07

agente_secreto


People also ask

How do I specify Ruby version?

Selecting a version of Ruby You'll need to install bundler 1.2. x or above to use the ruby keyword and bundler 1.13. x or above to use a Ruby version specifier. You can use the ruby keyword in your app's Gemfile to specify a specific version of Ruby.


2 Answers

If you use which ruby and TextMate says exec: rbenv: not found, you need to type this instead: rbenv which ruby. Use that path in TM_RUBY.

like image 165
Anthony Avatar answered Sep 23 '22 20:09

Anthony


Under preferences / advanced / shell variables, add a new variable called TM_RUBY. And enter the absolute path of your ruby binary.

You can get the latter by opening a terminal and typing:

which ruby
like image 43
Denis de Bernardy Avatar answered Sep 19 '22 20:09

Denis de Bernardy