Clean install OSX 10.9.1 returns "undefined method `path2class'" when trying to install gems

Niels Kristian picture Niels Kristian · Feb 11, 2014 · Viewed 7.1k times · Source

I just installed a clean Mavericks installation with Homebrew and RVM. Both brew doctor and rvm requirements return "all good", however, when I run bundle install in my project dir most of my gems install fine, but a handful fail to install with the same following error:

Bundler::GemspecError: Could not read gem at /Users/NK/.rvm/gems/ruby-2.0.0-p353/cache/eventmachine-1.0.3.gem. It may be corrupted.
An error occurred while installing eventmachine (1.0.3), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.0.3'` succeeds before bundling.

Then, if I try again with gem install eventmachine -v '1.0.3' I get:

ERROR:  Error installing eventmachine:
    invalid gem: package is corrupt, exception while verifying: undefined method `path2class' for #<Psych::ClassLoader:0x000001018f7990> (NoMethodError) in /Users/NK/.rvm/gems/ruby-2.0.0-p353/cache/eventmachine-1.0.3.gem

I tried to implode RVM and reinstall, but nothing helps.

Other people seem to have the same problem, but no one seems to have fund the answer yet:

EDIT

See those two as well:

Answer

Niels Kristian picture Niels Kristian · Feb 24, 2014

It turns out that this is a bug in an older version of psych, but it can't be solved, as long as you installed ruby with RVMs statically linked gems. So basically the problem is related to RVMs statically linked gems. Installing rubies with the --disable-binary solves the problem:

rvm install 2.0.0-p353 --disable-binary

Or reinstall with:

rvm reinstall 2.0.0-p353 --disable-binary