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:

  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.

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

Never 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 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.