TextMate can't find my RSpec gem in opt (from macports)
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/rub开发者_如何转开发ygems.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.
Just add a TM_RSPEC_HOME variable pointing to your rspec install.
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
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
精彩评论