agente_secreto
agente_secreto

Reputation: 8079

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.

Upvotes: 14

Views: 5010

Answers (5)

Daniel Farrell
Daniel Farrell

Reputation: 9750

The solution is actually very easy, no special install procedures are needed. As mentioned on the TextMate blog all you need to do is tell text mate your path variable. TextMate does not load this information by default. In Preferences, go to the Variables tab add a variable PATH (if it does not already exist) with the value, $PATH:/usr/local/bin. This tells TextMate to copy the system PATH. The system's ruby is in /usr/bin/ruby which is included in OSX default PATH. If you install a custom version of ruby then also append that path, for example here I have appended /usr/local/bin (don't forget the colon).

Updating the PATH variable in TextMate2 preference pane

Upvotes: 4

Anthony
Anthony

Reputation: 41

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.

Upvotes: 4

agente_secreto
agente_secreto

Reputation: 8079

Using the path that which ruby gave me didnt work. After googling for a while, I found a solution that worked, using the auto-ruby path of rvm as the TM_RUBY variable. The path is: /Users/0al0/.rvm/bin/rvm-auto-ruby This only applies if you are using rvm, of course.

Upvotes: 1

高見龍
高見龍

Reputation: 839

If you use RVM, maybe you can try to type:

> which rvm-auto-ruby
/Users/eddie/.rvm/bin/rvm-auto-ruby

and set this path as a shell variable named "TM_RUBY" in your textmate perferences like my screenshot

http://dl.dropbox.com/u/6931090/downloads/textmate-preferences.png

Hope that helps :)

Upvotes: 31

Denis de Bernardy
Denis de Bernardy

Reputation: 78533

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

Upvotes: 8

Related Questions