0

I know I've had this problem before so I'm really frustrated.

I've got the Ruby RSpec bundle installed for TextMate, but when I Run Behaviour Description or Run Focused Example I get this wonderful error:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:
in `report_activate_error': Could not find RubyGem rspec (>= 1.1.0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:
in `activate' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby
/1.8/rubygems.rb:68:in `gem' from /Users/simon/Library/Application Support/TextMate/Bundles/Ruby
RSpec.tmbundle/Support/lib/spec_mate.rb:13 from /tmp/temp_textmate.oWRPUR:3:in `require'
from /tmp/temp_textmate.oWRPUR:3

(I added linebreaks to make it readable)

I'm using macports so my rspec gem is installed in /opt/local/lib/ruby/gems/1.8/gems/. Why isn't it finding it?

In Preferences > Advanced > Shell Variables my TM_RUBY is set to /opt/local/bin/ruby. I also tried the trick here:

http://dnite.org/2007/8/28/textmate-and-your-environment-variables/

... which didn't do anything.

Simon Woodside
  • 7,175
  • 5
  • 50
  • 66

3 Answers3

0

Just add a TM_RSPEC_HOME variable pointing to your rspec install.

julienXX
  • 68
  • 2
  • When I do that, I get a different error: "Missing the Rails 2.3.2 gem". I think that the RSpec bundle is in fact trying to use the wrong ruby. (I do have TM_RUBY set to /opt/local/bin/ruby but that isn't helping) – Simon Woodside Apr 09 '10 at 03:58
  • you should also link /usr/bin/gem & /usr/bin/irb to the macports one. – julienXX Apr 09 '10 at 14:40
0

Well, the only solution I could find is unsubtle but works.

% cd /usr/bin/
% sudo mv ruby moved.ruby
% sudo ln -s /opt/local/bin/ruby ruby
Simon Woodside
  • 7,175
  • 5
  • 50
  • 66
0

I just ran across this same issue with a new install of TextMate and Snow Leopard. Go to Preferences > Advanced > Shell Variables, and along with TM_RUBY, make sure PATH is set so the ruby you want it to find is first.

I use rvm, so this symbolic link...

/usr/local/bin/ruby -> /Users/jjulian/.rvm/bin/textmate_ruby

...allows me to tell textmate that the first entry on my PATH is /usr/local/bin:

PATH  /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Now it always finds .rvm/bin/textmate_ruby

Jonathan Julian
  • 12,163
  • 2
  • 42
  • 48