RubyVersionIssue

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.

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.