Rails/Ruby Error When Creating Database: Unable to load the EventMachine C extension

Fitz picture Fitz · Jan 3, 2013 · Viewed 11.5k times · Source

Update:

the eventmachine gem is installed and in my gemfile:

 eventmachine (1.0.0, 0.12.10)

Please help! Trying to create a database with the following:

Fitzs-MacBook-Pro:twilio_insanity Fitz$ rake db:create'

Returns the following error:

Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby' rake aborted! cannot load such file -- rubyeventmachine /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/eventmachine-1.0.0/lib/eventmachine.rb:8:in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/eventmachine-1.0.0/lib/eventmachine.rb:8:in ' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/thin-1.5.0/lib/thin.rb:7:in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/thin-1.5.0/lib/thin.rb:7:in ' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in block (2 levels) in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in each' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in block in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in each' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler.rb:128:in require' /Users/Fitz/Desktop/twilio_insanity/config/application.rb:7:in' /Users/Fitz/Desktop/twilio_insanity/Rakefile:5:in require' /Users/Fitz/Desktop/twilio_insanity/Rakefile:5:in' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/bin/ruby_noexec_wrapper:14:in eval' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/bin/ruby_noexec_wrapper:14:in ' (See full trace by running task with --trace)

```

Answer

Siwei picture Siwei · Dec 19, 2013

try to re-install the gem 'eventmachine'

$ gem uninstall eventmachine

then

$ bundle install  ( in the same folder with your Gemfile) 

or just

$ gem install eventmachine ( if you are not using the Gemfile) 

see: https://stackoverflow.com/a/15140634/445908