4

我正在尝试使用 GEM 安装指南针,但我有很多错误。

我的 macbook pro 正在运行 OS X Yosemite。

有人有同样的问题吗?

感谢您的时间。祝你今天过得愉快

sudo gem install compass
Password:
ERROR:  Error installing compass:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20141019-17085-1dv9dek.rb extconf.rb
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.5/ext/ffi_c in PATH, mode 040777
checking for ffi.h... /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:502:in `with_werror'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
    from extconf.rb:16:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.5 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/ffi-1.9.5/gem_make.out
4

3 回答 3

4

实际上,这似乎在通过命令行安装“指南针”时已成功回答接收错误“extconf failed, exit code 1”

您显然需要先安装开发工具(xcode-select --install),然后安装 compass

祝你好运!

于 2014-10-20T19:17:27.723 回答
1

好吧,您不应该为了一件事在全球范围内安装 gems。在安装 compass 和其他 gem 之前,我强烈建议您安装 rbenv,然后安装您想要的 ruby​​ 版本。然后,您可以在用户级别安装 gems,而不必担心在用户之外的目录上设置写权限。- 在这种情况下,这似乎是问题所在。

只需按照此处的说明进行 rbenv https://github.com/sstephenson/rbenv然后安装 ruby​​ 构建插件https://github.com/sstephenson/ruby-build

于 2014-10-19T15:42:19.107 回答
0

只需sudo chmod go-w /usr/local/以管理员身份从终端运行。

这对我有用

于 2015-09-03T08:36:10.127 回答