Rails - cannot run app: Unable to load the EventMachine C extension;

user984621 picture user984621 · Feb 12, 2013 · Viewed 17k times · Source

When I run an app on Lion OS X, I get this error:

Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-1.0.0/lib/eventmachine.rb:8:in `require': no such file to load -- rubyeventmachine (LoadError)
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-1.0.0/lib/eventmachine.rb:8:in `<top (required)>'
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
    from /Users/adam/rubydev/future_computers/config/application.rb:7:in `<top (required)>'
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands.rb:53:in `require'
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap'
    from /Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'adam

I don't really know how to fix this, I've added the eventmachine gem into the Gemfile, but it didn't help...

Could you help me, please, how to fix it?

Thank you

Answer

prettycoder picture prettycoder · Feb 28, 2013

In my case this fixed it:

  • $ gem uninstall eventmachine
  • at the prompt tell it to uninstall all versions (it tells you about dependencies)
  • $ bundle install

I was reading through this https://github.com/eventmachine/eventmachine/issues/333. There were problems with eventmachine, so making sure I got the newest version seemed a good idea.