OSX Yosemite和Xcode 6安装后的Ruby gem安装错误

时间:2014-06-09 03:21:08

标签: ruby macos gem xcode6

我在安装Yosemite之前尝试安装了一个像我一样的宝石,但是现在我收到了一个错误:

/Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:159:in“synchronize”:错误:无法构建gem原生扩展。 (GEM ::分机:: BuildError)

错误:无法构建gem原生扩展。

死锁;递归锁定

这是我写的命令:

sudo gem install mysql2

这是它在终端中显示的消息:

  

Gem文件将保持安装状态   /Library/Ruby/Gems/2.0.0/gems/autotest-fsevent-0.2.9进行检查。   记录结果   /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/autotest-fsevent-0.2.9/gem_make.out

     

Gem文件将保持安装状态   /Library/Ruby/Gems/2.0.0/gems/autotest-fsevent-0.2.9进行检查。   记录结果   /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/autotest-fsevent-0.2.9/gem_make.out     来自/Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:159:in   build_extension' from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:198:in阻止   来自的build_extensions   /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in each' from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in build_extensions'来自   /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1436:in block in build_extensions' from /Library/Ruby/Site/2.0.0/rubygems/user_interaction.rb:45:in use_ui'     来自/Library/Ruby/Site/2.0.0/rubygems/specification.rb:1434:in   来自build_extensions' from /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:60:in build_extensions'   /Library/Ruby/Site/2.0.0/rubygems/basic_specification.rb:56:in   contains_requirable_file?' from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:925:in阻止   find_inactive_by_path'来自   /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in each' from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in find'from   /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in   来自find_inactive_by_path' from /Library/Ruby/Site/2.0.0/rubygems.rb:185:in try_activate'   /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:132:in   rescue in require' from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:144:in 要求'来自/Library/Ruby/Site/2.0.0/rubygems.rb:601:in   load_yaml' from /Library/Ruby/Site/2.0.0/rubygems/config_file.rb:328:in LOAD_FILE”     来自/Library/Ruby/Site/2.0.0/rubygems/config_file.rb:197:in   initialize' from /Library/Ruby/Site/2.0.0/rubygems.rb:289:in新的”     from /Library/Ruby/Site/2.0.0/rubygems.rb:289:in configuration' from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:63:in run'     来自/Library/Ruby/Site/2.0.0/rubygems/ext/ext_conf_builder.rb:38:in   block in build' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tempfile.rb:324:in 打开'来自   /Library/Ruby/Site/2.0.0/rubygems/ext/ext_conf_builder.rb:17:in   来自build_extension的build' from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:161:in 块(2个级别)   /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:160:in chdir' from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:160:in阻止   build_extension'来自   /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:159:in synchronize' from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:159:in build_extension'来自   /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:198:in block in build_extensions' from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in每个'来自   /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in   build_extensions' from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1436:in阻止   来自的build_extensions   /Library/Ruby/Site/2.0.0/rubygems/user_interaction.rb:45:in use_ui' from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1434:in build_extensions'来自   /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:60:in   build_extensions' from /Library/Ruby/Site/2.0.0/rubygems/basic_specification.rb:56:in contains_requirable_file?从   /Library/Ruby/Site/2.0.0/rubygems/specification.rb:925:in block in find_inactive_by_path' from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in每个'来自   /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in find' from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in find_inactive_by_path'来自   /Library/Ruby/Site/2.0.0/rubygems.rb:185:in try_activate' from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:132:in 救援需要'来自   /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:144:in   来自require' from /Library/Ruby/Site/2.0.0/rubygems.rb:601:in load_yaml'   /Library/Ruby/Site/2.0.0/rubygems/config_file.rb:328:in load_file' from /Library/Ruby/Site/2.0.0/rubygems/config_file.rb:197:in 初始化'来自   /Library/Ruby/Site/2.0.0/rubygems/gem_runner.rb:74:in new' from /Library/Ruby/Site/2.0.0/rubygems/gem_runner.rb:74:in do_configuration'来自   /Library/Ruby/Site/2.0.0/rubygems/gem_runner.rb:39:in run' from /usr/bin/gem:21:in'

我正在使用OSX 10.10和Xcode 6 Beta。

你们中的任何人都知道如何处理这件事吗?

2 个答案:

答案 0 :(得分:3)

当我通过bitnami安装mysql时遇到了同样的问题,看起来你没有所有必需的mysql库。

我使用了brewsh并通过

重新安装了mysql
brew install mysql

sudo gem install mysql2

此外,您需要在主目录中的.profile文件中加载动态库,您可以通过在.profile文件中添加这些行来实现此目的。

export PATH=$PATH:$MYSQL
export DYLD_LIBRARY_PATH=/Applications/mysql/lib:$DYLD_LIBRARY_PATH

在以上两行代码中

/ Applications / mysql / lib,是安装mysql库的路径,在你的mysql库中可能会有所不同,请根据你的环境进行检查和使用

答案 1 :(得分:0)

我有同样的问题。使用RVM降级为ruby 1.9.3在10.10 Yosemite上为我解决了问题 - 以下是采取的步骤:

$ \curl -sSL https://get.rvm.io | bash
$ source /Users/shedali/.rvm/scripts/rvm
$ rvm install 1.9.3 --with-gcc=clang
$ gem install [packagename]