RubyVersionIssue

Troubleshooting.RubyVersionIssue History

Hide minor edits - Show changes to markup

July 04, 2011, at 08:14 UTC by Tom De Leu - Fixed typo.
Changed line 15 from:

Newer ever do #1. This is bad! Really bad! Please just don’t do it!

to:

Never ever do #1. This is bad! Really bad! Please just don’t do it!

July 06, 2010, at 07:00 UTC by Allan Odgaard - Change “how to update PATH” link
Changed line 21 from:

[1]: http://manual.macromates.com/en/shell_commands#search_path

to:

[1]: http://wiki.macromates.com/Troubleshooting/TextMateAndThePath

November 24, 2009, at 11:38 UTC by Allan Odgaard - Update to reflect r1589 changes
Changed lines 1-4 from:

Many of TextMate’s commands use `ruby` and there also is a RubyMate command to run your current ruby script (⌘R).

All these commands work out-of-the-box on a standard Tiger install, but there is a few ways to break some or all of them:

to:

Many of TextMate’s commands use `ruby` and there also is a Ruby → Run command to run your current ruby script (⌘R).

All these commands work out-of-the-box on a standard Tiger/Leopard/Snow Leopard install, but there are ways to break some or all of them:

Changed lines 13-28 from:

If you do install a newer version of Ruby, you likely want all TextMate commands to use that, especially if the script you want to run in RubyMate require include files only present in the newest version of Ruby, or you globally set the `RUBYOPT` environment variable in a way that makes the old `ruby` output an error.

To do this you need to update your `PATH` variable so that the location where the new ruby is found, is placed before `/usr/bin`. The tricky part here is that there are two *different* execution contexts in TextMate, one gets the value of `PATH` from your regular `sh`/`bash` startup files (and most already have this setup correctly) where the other inherits the value from Finder.

To setup the `PATH` for Finder, please see the last paragraphs at [this page](http://manual.macromates.com/en/shell_commands#search_path).

If you've set your `PATH` in .bash_profile or somewhere else, make sure you put quotes around the assignment. This deals with the situation of having path elements that have spaces in them. For example:

    export PATH="$HOME/bin:$PATH"

A quick way to test that TextMate gets the proper value of `PATH` in this other execution context is by entering these two lines into a new buffer:

    #!/bin/sh
    echo "$PATH"

Select **both** lines and press ⌃R.

to:

5. Installing a version of `ruby` which is not compatible with TextMate’s ruby extensions (64 bit builds of `ruby` on Snow Leopard)

Newer ever do #1. This is bad! Really bad! Please just don’t do it!

Assuming you did not delete `/usr/bin/ruby` the proper way to get TextMate to use your custom installed ruby is either [updating `PATH`][1] so that the directory with your new ruby is listed before `/usr/bin` or alternatively to set `TM_RUBY` to the version of ruby you wish to use (e.g. `/usr/local/bin/ruby`).

Be aware though that the latter will not affect all TextMate commands, it will however affect the version of ruby used to validate your script (⌃⇧V) and to run it (⌘R). There should be no real reason wanting the other commands to use your new ruby.

[1]: http://manual.macromates.com/en/shell_commands#search_path

June 17, 2008, at 13:28 UTC by Allan Odgaard - Fix manual path
Changed lines 17-18 from:

To setup the `PATH` for Finder, please see the last paragraphs at [this page](http://macromates.com/textmate/manual/shell_commands#search_path).

to:

To setup the `PATH` for Finder, please see the last paragraphs at [this page](http://manual.macromates.com/en/shell_commands#search_path).

Changed line 28 from:

Select **both** lines and press ⌃R.

to:

Select **both** lines and press ⌃R.

May 02, 2008, at 19:11 UTC by Allan Odgaard - Remove (:markdown:)
Deleted lines 0-1:

(:markdown:)

Deleted lines 28-29:

(:markdownend:)

August 31, 2007, at 13:59 UTC by Phil Verghese -
Added lines 21-24:

If you've set your `PATH` in .bash_profile or somewhere else, make sure you put quotes around the assignment. This deals with the situation of having path elements that have spaces in them. For example:

    export PATH="$HOME/bin:$PATH"
June 14, 2007, at 14:43 UTC by Allan Odgaard -
Added lines 1-28:

(:markdown:)

Many of TextMate’s commands use `ruby` and there also is a RubyMate command to run your current ruby script (⌘R).

All these commands work out-of-the-box on a standard Tiger install, but there is a few ways to break some or all of them:

1. Overwriting or removing `/usr/bin/ruby`.

2. Setting `RUBYOPT` e.g. to `rubygems` but not having that installed for all your versions of `ruby`

3. Setting `TM_RUBY` to a bogus value.

4. Setting `PATH` to a bogus value.

If you do install a newer version of Ruby, you likely want all TextMate commands to use that, especially if the script you want to run in RubyMate require include files only present in the newest version of Ruby, or you globally set the `RUBYOPT` environment variable in a way that makes the old `ruby` output an error.

To do this you need to update your `PATH` variable so that the location where the new ruby is found, is placed before `/usr/bin`. The tricky part here is that there are two *different* execution contexts in TextMate, one gets the value of `PATH` from your regular `sh`/`bash` startup files (and most already have this setup correctly) where the other inherits the value from Finder.

To setup the `PATH` for Finder, please see the last paragraphs at [this page](http://macromates.com/textmate/manual/shell_commands#search_path).

A quick way to test that TextMate gets the proper value of `PATH` in this other execution context is by entering these two lines into a new buffer:

    #!/bin/sh
    echo "$PATH"

Select **both** lines and press ⌃R.

(:markdownend:)