* Walter Lee Davis waltd@wdstudio.com [2007-03-17 10:19]:
gray:~ waltd$ echo $PATH /usr/local/bin:/usr/local/sbin:/usr/local/mysql:/usr/local/mysql/bin:/ usr/local:/usr/local/php5:/usr/local/php5/bin:/bin:/sbin:/usr/bin:/usr/ sbin
Unfortunately, this isn't the path used by TextMate when it runs commands with shebang lines.
Type puts ENV["PATH"] in a TextMate window and then hit ⌃⇧E (Execute Line as Ruby). You should get a line like /usr/bin:/bin:/usr/sbin:/sbin
If you run ⌃⇧E again with puts VERSION you'll probably get 1.8.2, the default OS X Ruby version.
The easiest way to fix this is to go to Preferences → Advanced → Shell Variables and add TM_RUBY with a value of /usr/local/bin/ruby.
The more thorough way is to edit .MacOSX/environment.plist as outlined in the "important" section of the shell commands page.