Can't install eventmachine on mac osx snow leopard

I've searched for this issue and kept finding resources related to PC. Every time I try to install the eventmachine gem I get this error:

Building native extensions. This could take a while... ERROR: Error installing eventmachine: ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb checking for rb_trap_immediate in ruby.h,rubysig.h... * extconf.rb failed * Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/bin/ruby /usr/local/lib/ruby/1.9.1/mkmf.rb:368:in try_do': The complier failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/local/lib/ruby/1.9.1/mkmf.rb:446:in try_do': The complier failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/local/lib/ruby/1.9.1/mkmf.rb:446:in try_do': The complier failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/local/lib/ruby/1.9.1/mkmf.rb:446:in try_compile' from /usr/local/lib/ruby/1.9.1/mkmf.rb:568:in try_var' from /usr/local/lib/ruby/1.9.1/mkmf.rb:816:in block in have_var' from /usr/local/lib/ruby/1.9.1/mkmf.rb:693:in block in checking_for' from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in block (2 levels) in postpone' from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in open' from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in block in postpone' from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in open' from /usr/local/lib/ruby/1.9.1/mkmf.rb:276:in postpone' from /usr/local/lib/ruby/1.9.1/mkmf.rb:692:in checking_for' from /usr/local/lib/ruby/1.9.1/mkmf.rb:815:in have_var' from extconf.rb:16:in `'

Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10 for inspection. Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/ext/gem_make.out

It seems to break while building c extensions and I've tried various solutions like this one but no luck.


Your problem might be because you haven't installed the developer tools for Xcode 4.2/4.3.

With Xcode 4.2.x and 4.3.x, you need to install command line tool separately, by following directions:

  • Launching Xcode Open “Preferences” from the “Xcode” item on the menu bar.
  • Select “Downloads” tab (icon).
  • Click “Install” button for “Command Line Tools” (directions borrowed from my friend's site here)
  • If correctly installed, then cc --version should emit:

    % cc --version

    Apple clang version 3.1 (tags/Apple/clang-318.0.54) (based on LLVM 3.1svn)
    Target: x86_64-apple-darwin11.3.0
    Thread model: posix
    

    OR

    If you are using Ruby 1.9.3, there are known issues with EventMachine. See http://isitruby19.com/eventmachine. I suggest you downgrade to 1.9.2 for projects needing eventmachine using RVM or rbenv.


    You will need to have XCode 3.2 or 4 installed in order for extensions like this to compile. The XCode package is an optional install and comes on either the main install DVD for a retail package of the OS or as a supplemental disc with a new system.

    You can download it from the App Store for 10.7 or later.


    The solution here worked for me. I just had to install command line tools from https://developer.apple.com/downloads/index.action

    getting eventmachine gem to compile on OSX Lion 10.8.2 with xcode 4.5.1

    链接地址: http://www.djcxy.com/p/33244.html

    上一篇: 如何正确处理打字稿中的promisifyAll?

    下一篇: 无法在mac osx snow leopard上安装eventmachine