Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs shell can't find ruby gems -- e.g., Could not find RubyGem haml (>= 0) (Gem::LoadError)

My emacs shell can't load any of my installed ruby gems. I'm getting a Gem::LoadError when trying to execute any installed gem from emacs but it works from Terminal. Here's all the information I've reviewed in my environment. Thanks for any help!

  • Running Emacs.app on my Mac OSX Snow Leopard (from emacsformacosx using universal dmg).
  • Installed RVM, then used RVM to install Ruby 1.9.2 and 1.8.7.
  • Installed several gems, including rails and haml.
  • Did not use root for these installs.

From Terminal (bash), I'm able to run the gems (e.g., haml somepage.haml or rails create someapp)

In emacs, I've set the shell (bash) path to load the same as the terminal shell (via ~/.MacOSX/application.plist).

echo $PATH returns the same result from terminal and emacs

I can run IRB and rvm from emacs shell.

Running gem list from emacs shell shows I have haml (3.1.2, 3.1.1) installed. Running: which rvm, which gem, which haml #all return the same path in both Terminal and Emacs

When I try to execute a gem (e.g., haml), I get the following:

/Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:900:in report_activate_error': Could not find RubyGem haml (>= 0) (Gem::LoadError) from /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:248:in activate' from /Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1276:in gem' from /Users/me/.rvm/gems/ruby-1.9.2-p180/bin/haml:18:in '

like image 876
pfries Avatar asked Jun 14 '11 15:06

pfries


1 Answers

Make sure your GEM_HOME environment variable is set properly or you may have trouble. rvm does move this from the usual location, and bundler can move it again.

This is particularly important if you're loading gems from your home directory because they are managed by rvm.

like image 103
tadman Avatar answered Sep 24 '22 15:09

tadman