Topic: Textmate is running wrong version of Ruby

Hi,

When I run ruby code in Textmate, it is running 1.8.2 that ships with Tiger. Since I have installed Ruby 1.8.6 in /usr/local/ruby, how can I tell textmate to look in the correct folder?


EDIT: actually running ruby code uses 1.8.6, but it is the validation that is using 1.8.2.

Last edited by Johnson (2008-04-17 15:12:57)

Re: Textmate is running wrong version of Ruby

You can specify the ruby version TM uses by setting the
TM_RUBY env variable in the Preferences.
As a menu sequence:

TextMate - Preferences - Advanced - Shell Variables.

Click the plus sign at the bottom.

Enter the name TM_RUBY.

Enter the full path to the binary you want to use as the value.

eg. /usr/local/bin/ruby

matthias

Re: Textmate is running wrong version of Ruby

Hi thanks for your tip. Now it certainly is using the correct ruby binary, but it still displays 1.8.2.

Anyway.

Re: Textmate is running wrong version of Ruby

It displays 1.8.2 when you do what?

Re: Textmate is running wrong version of Ruby

When I run the validator. There is a little tooltip that pops up which tells me that the syntax is correct and that it is Ruby 1.8.2.

Re: Textmate is running wrong version of Ruby

The validate syntax command runs a script with shebang:

#!/usr/bin/env ruby

so env searches the dirs in PATH variable for a ruby command. Be sure to include the path to your ruby binary in your PATH. eg in ~/.bash_profile:

export PATH="/usr/local/bin:/usr/bin:$PATH"

Re: Textmate is running wrong version of Ruby

My $PATH is correctly set, otherwise Rails 2.0 wouldn't be working.

Re: Textmate is running wrong version of Ruby

You'll have to create ~/.MacOSX/environment.plist and add the following:

{ PATH = "/usr/local:/usr/bin:/bin:/usr/sbin:/sbin"; }

After that you have to re-login to your user account and then it should work smile.

Matthias

Re: Textmate is running wrong version of Ruby

Yes it worked, thanks for the info.