2014-09-04 96 views
4

我在安裝在單獨分區上的Yosemite DP 7上安裝Cocoapods時遇到問題。我已嘗試遵循Cocoapods with Xcode 6 and 10.10 Yosemite上發現的指示以及由於堆棧溢出鏈路上提出的相同解決方案而關閉的問題(https://github.com/CocoaPods/CocoaPods/issues/2219)中的指示。無法在Yosemite DP上安裝Cocoapods 7

我不斷收到以下錯誤:

Rasmuss-MacBook-Pro:~ rasmusth$ sudo gem install cocoapods 
Building native extensions. This could take a while... 
ERROR: Error installing cocoapods: 
    ERROR: Failed to build gem native extension. 

    "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby" -rubygems /Library/Ruby/Gems/2.0.0/gems/rake-0.9.6/bin/rake RUBYARCHDIR=/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext RUBYLIBDIR=/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb 
checking for -std=c99 option to compiler... *** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby 
/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 extconf.rb:24:in `block in <main>' 
    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 extconf.rb:23:in `<main>' 
rake aborted! 
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...] 
/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext/xcodeproj/Rakefile:37:in `block in <top (required)>' 
Tasks: TOP => default => ext 
(See full trace by running task with --trace) 


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0 for inspection. 
Results logged to /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext/xcodeproj/gem_make.out 

我懷疑這可能與事實,我有優山美地在一個單獨的分區做,但除此之外,我無言以對。

+0

我遇到類似的問題與你,我的發展環境有問題。您可以從[這裏]獲取一些信息(http://stackoverflow.com/questions/24841392/install-cocoapods-failed-on-mac) – pangpang 2014-09-04 11:38:09

+0

我的問題描述的一部分指出我嘗試了確切的解決方案描述。 – 2014-09-04 12:49:45

+0

我在一個分區上有優勝美地,遇到同樣的問題。 – DeepFriedTwinkie 2014-09-04 16:14:39

回答

10

我遇到了同樣的問題。經過與其他人相同的步驟拉了很多頭髮後,下面的工作。

  1. $的Xcode選--install(確認命令行工具安裝)

  2. 安裝NVM穩定(並自制):$ \捲曲-ssl https://get.rvm.io |慶典-s穩定

  3. 關閉/重新打開終端

  4. 安裝了Ruby 2.1.2:$ RVM安裝2.1

  5. 切換到它:$ RVM使用2.1

  6. 卸載/重裝xcodeproj和cocoapods

+0

謝謝!非常有幫助! – ggould75 2014-09-05 12:11:15

+0

事實上,這是唯一的解決方案,我與優勝美地DP7和Xcode6通用汽車,謝謝。 – 2014-09-12 08:04:38

0

Xcode 6.0 GM缺少10.10 SDK,因此gem xcodeproj無法編譯,其中有一些需要10.10 SDK的C代碼。 這將在未來得到解決。 現在你可以解決它像這樣:

  • 終端:sudo的創業板卸載的CocoaPods xcodeproj
  • 下載的Xcode 6.1(現在Beta 2的是目前的一個)
  • 開始就進入設置 - >位置 - >命令行工具 - >切換到的Xcode 6.1測試版
  • 終端:sudo的創業板安裝的CocoaPods
  • 更改您的命令行工具回到GM(如果你想/需要)

欲瞭解更多信息,請參閱:https://github.com/CocoaPods/CocoaPods/issues/2432