开发者

Could not find RubyGem haml

Using a fresh install of Ruby 1.9.2 (via RVM), Textmate, and the Handcrafted Haml bundle, I get the following error when trying to use it:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in report_activate_error': Could not find RubyGem haml (>= 0) (Gem::LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:inactivate' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem' from -e:1

I ran sudo gem install haml and it installed successfully. The output of ruby -v is 1.9.2p180. It seems like TextMate is still looking for my system (Mac OS X) version of Ruby, not the new one (1.9.2) I installed. 开发者_如何学JAVAWhen I look at the gemsets for my RVM-managed Ruby 1.9.2 installation, the Haml gem is loaded. Any thoughts on how to get TextMate to search for the gem in my new/correct gemset?


You need to tell TextMate which Ruby to use. As you guessed and can see from the error, the PATH for TextMate causes it to use /usr/bin/ruby. See these questions and their answers:

  • How do I get Textmate to use MacRuby?
  • TextMate, rvm and TM_RUBY
  • Using RVM with different gemsets in TextMate

I personally use my own non-RVM hand-compiled Ruby in /usr/local/bin and so I go into
TextMate->Preferences->Advanced->Shell Variables
and create a variable named PATH that is set to
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Note that I've put /usr/local/bin before /usr/bin so that my ruby is found before the system's.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜