升级到OS X 10.10 Yosemite后,gem install停止工作

时间:2014-10-18 01:16:20

标签: ruby macos gem osx-yosemite

我升级到OS X Yosemite并且gem install停止了工作。

当我运行它时,我看到了这个大丑陋的错误:

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

    ruby -r ./siteconf.rb extconf.rb
checking for random()... *** 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=ruby
    --with-rdiscount-dir
    --without-rdiscount-dir
    --with-rdiscount-include
    --without-rdiscount-include=${rdiscount-dir}/include
    --with-rdiscount-lib
    --without-rdiscount-lib=${rdiscount-dir}/
mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from mkmf.rb:513:in `block in try_link0'
    from tmpdir.rb:88:in `mktmpdir'
    from mkmf.rb:510:in `try_link0'
    from mkmf.rb:534:in `try_link'
    from mkmf.rb:720:in `try_func'
    from mkmf.rb:1004:in `block in have_func'
    from mkmf.rb:895:in `block in checking_for'
    from mkmf.rb:340:in `block (2 levels) in postpone'
    from mkmf.rb:310:in `open'
    from mkmf.rb:340:in `block in postpone'
    from mkmf.rb:310:in `open'
    from mkmf.rb:336:in `postpone'
    from mkmf.rb:894:in `checking_for'
    from mkmf.rb:1003:in `have_func'
    from extconf.rb:5:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in rdiscount-2.1.7.1 for inspection.
Results logged to /gem_make.out

1 个答案:

答案 0 :(得分:1)

当您升级到Yosemite Xcode命令行工具变得不可用时。

运行此命令,然后按照屏幕上的说明进行操作。

$  xcode-select --install
xcode-select: note: install requested for command line developer tools