带有 Xcode 6 和 10.10 Yosemite 的 Cocoapods

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24018355/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:06:41  来源:igfitidea点击:

Cocoapods with Xcode 6 and 10.10 Yosemite

xcodecocoapodsosx-yosemiteosx-yosemite-beta

提问by Adam Fox

After initially upgrading to 10.10 and XCode6-Beta, I tried to run 'pod update' and I received this error:

最初升级到 10.10 和 XCode6-Beta 后,我尝试运行“pod update”,但收到此错误:

cannot load such file -- xcodeproj/prebuilt/universal.x86_64-darwin14-2.0.0/xcodeproj_ext (LoadError)

I tried to update Cocoapods using 'sudo gem install cocoapods', but received another error:

我尝试使用 'sudo gem install cocoapods' 更新 Cocoapods,但收到另一个错误:

Fetching: xcodeproj-0.17.0.gem (100%)
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-10.1.1/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.

Has anyone else been able to successfully use Cocoapods with Xcode 6 on 10.10 Yosemite?

有没有其他人能够在 10.10 Yosemite 上成功地将 Cocoapods 与 Xcode 6 一起使用?

回答by HighFlyingFantasy

  1. Open Xcode 6
  2. Open Preferences
  3. Click the Locations tab
  4. Change the Command Line Toolsversion to Xcode 6.0
  5. Uninstall cocoapods
    $ sudo gem uninstall cocoapods
  6. Uninstall xcodeproj $ sudo gem uninstall xcodeproj
  7. Install xcodeproj
    $ sudo gem install xcodeproj
  8. Install cocoapods
    $ sudo gem install cocoapods
  9. Run pod --versionto verify that it worked
  1. 打开 Xcode 6
  2. 打开首选项
  3. 单击位置选项卡
  4. Command Line Tools版本更改为Xcode 6.0
  5. 卸载 cocoapods
    $ sudo gem uninstall cocoapods
  6. 卸载 xcodeproj $ sudo gem uninstall xcodeproj
  7. 安装 xcodeproj
    $ sudo gem install xcodeproj
  8. 安装 cocoapods
    $ sudo gem install cocoapods
  9. 运行pod --version以验证它是否有效

回答by johnyorke

// Running Xcode6-Beta7 on 10.10 (14A343f)

// 在 10.10 (14A343f) 上运行 Xcode6-Beta7

I have tried all of the above and didn't have any luck. Here's what worked for me:

我已经尝试了上述所有方法,但没有任何运气。以下是对我有用的内容:

I installed the latest version of Ruby via Homebrew(took a few minutes)

我通过Homebrew安装了最新版本的 Ruby (花了几分钟)

brew install ruby

then installed Cocoapods as usual

然后像往常一样安装 Cocoapods

sudo gem install cocoapods

and it worked a treat!

它起到了很好的作用!

回答by F79

Follow these steps:

按着这些次序:

1- Open Xcode 6, open Preferences, click the Locations tab, change the Command Line Tools version to Xcode 6.0

1- 打开 Xcode 6,打开 Preferences,单击 Locations 选项卡,将 Command Line Tools 版本更改为 Xcode 6.0

2- sudo gem uninstall cocoapods

2- sudo gem 卸载 cocoapods

3- sudo gem uninstall xcodeproj

3- sudo gem 卸载 xcodeproj

4- ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

4- ruby​​ -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

5- curl -L https://get.rvm.io| bash -s stable --ruby

5- curl -L https://get.rvm.io| bash -s 稳定 --ruby

6- source /Users/your_user_name/.rvm/scripts/rvm

6- source /Users/your_user_name/.rvm/scripts/rvm

7- rvm reload

7- rvm 重装

8- rvm rubygems latest --force

8- rvm ruby​​gems 最新 --force

9- gem install xcodeproj

9- gem 安装 xcodeproj

10- gem install cocoapods

10- gem 安装 cocoapods

8- pod --version

8- pod --version

回答by andrewmclean

In addition to uninstalling cocoapods and installing xcodeproj gems. I also had to tell rvm to use the system ruby. Strange because my rvm install was 2.0.0 as was the system version after switching to use 6.0.0 Command Line Tools

除了卸载 cocoapods 和安装 xcodeproj gems。我还必须告诉 rvm 使用系统 ruby​​。奇怪,因为我的 rvm 安装是 2.0.0 和切换到使用 6.0.0 命令行工具后的系统版本

rvm use system    
sudo gem uninstall cocoapods
sudo gem install xcodeproj
sudo gem install cocoapods
pod install

回答by hashier

Xcode 6.0 GM is missing the 10.10 SDK and therefore the gem xcodeprojcan't be compiled which has some C code in it which needs the 10.10 SDK. This is going to be fixed in the future. For now you can work around it like this (noneed for rvmor anything else):

Xcode 6.0 GM 缺少 10.10 SDK,因此xcodeproj无法编译gem ,其中包含一些需要 10.10 SDK 的 C 代码。这将在未来得到修复。现在,你可以解决它像这样(没有需要rvm或其他任何东西):

  • Terminal: sudo gem uninstall cocoapods xcodeproj
  • Download Xcode 6.1 (right now Beta 2 is the current one)
  • Start it go to Settings -> Location -> Command Line Tools -> Change to Xcode 6.1 Beta
  • Terminal: sudo gem install cocoapods
  • Change your Command Line tools back to GM (if you want/need)
  • 终端: sudo gem uninstall cocoapods xcodeproj
  • 下载 Xcode 6.1(现在 Beta 2 是当前版本)
  • 启动它,转到设置 -> 位置 -> 命令行工具 -> 更改为 Xcode 6.1 Beta
  • 终端: sudo gem install cocoapods
  • 将您的命令行工具改回 GM(如果您想要/需要)

For more information see: https://github.com/CocoaPods/CocoaPods/issues/2432

更多信息请参见:https: //github.com/CocoaPods/CocoaPods/issues/2432

回答by Adam Fox

Okay, looks like it's been reported and has a workaround: https://github.com/CocoaPods/CocoaPods/issues/2219

好的,看起来它已经被报告并且有一个解决方法:https: //github.com/CocoaPods/CocoaPods/issues/2219

The following worked for me:

以下对我有用:

sudo gem uninstall cocoapods
sudo gem install xcodeproj
sudo gem install cocoapods
pod update

回答by Phat Le

Try it:

尝试一下:

/usr/bin/login -f your_mac_username

/usr/bin/login -f your_mac_username

cd "to your project"

cd“到你的项目”

pod install

吊舱安装

Done.

完毕。

回答by alloy

We released CocoaPods 0.34 which no longer has any C based extensions and will install without even installing Xcode, thus should be able to work around this tough setup that Apple gave us all.

我们发布了 CocoaPods 0.34,它不再有任何基于 C 的扩展,甚至不需要安装 Xcode 就可以安装,因此应该能够解决 Apple 给我们的这个艰难的设置。

回答by touti

i found this solution in this link

我在这个链接中找到了这个解决方案

$sudo ln -s /Applications/Xcode6-Beta7.app /Applications/Xcode.app $sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.Internal.sdk $ sudo gem install cocoapods

$sudo ln -s /Applications/Xcode6-Beta7.app /Applications/Xcode.app $sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.Internal.sdk $ sudo gem install cocoapods

once the installation done, you can delete the links like so :

安装完成后,您可以像这样删除链接:

$ rm /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.Internal.sdk $ rm /Applications/Xcode.app

$ rm /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.Internal.sdk $ rm /Applications/Xcode.app

回答by KrauseFx

I solved this problem by re-downloading the latest version of the Command Line Tools for 10.10

我通过重新下载 10.10 的最新版命令行工具解决了这个问题