无法更新cocoapods

时间:2013-10-23 21:09:05

标签: ios cocoapods

在尝试更新我的cocoapods之前,我在:

pod --version

0.22.3

每当我进行pod安装时,我都会在控制台中看到以下消息:

CocoaPods 0.26.2 is available.

然而,每当我尝试更新Cocoapods时,它似乎都不起作用:

$ 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/1.8/usr/bin/ruby extconf.rb
checking for -std=c99 option to compiler... yes
checking for CoreFoundation... yes
checking for CoreFoundation/CoreFoundation.h... yes
checking for CoreFoundation/CFStream.h... yes
checking for CoreFoundation/CFPropertyList.h... yes
checking for ruby/st.h... yes
creating extconf.h
creating Makefile

make
xcrun cc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -DRUBY_EXTCONF_H=\"extconf.h\"  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common  -std=c99  -c xcodeproj_ext.c
xcrun: Error: could not stat active Xcode path '/Volumes/Xcode/Xcode.app/Contents/Developer'. (No such file or directory)
cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o xcodeproj_ext.bundle xcodeproj_ext.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64  -ObjC -framework CoreFoundation    -lruby  -lpthread -ldl -lobjc  
clang: error: no such file or directory: 'xcodeproj_ext.o'
make: *** [xcodeproj_ext.bundle] Error 1


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



pod --version
0.22.3

2 个答案:

答案 0 :(得分:2)

看起来您正在使用卷中的Xcode,而不是来自磁盘上已安装的副本。它试图在以下路径中找到xcode

/Volumes/Xcode/Xcode.app/Contents/Developer'. (No such file or directory)

您是否正在使用磁盘映像中的xcode?如果没有,则需要使用以下命令切换xcode的活动版本:

sudo xcode-select -switch /Applications/Xcode.app

xcrun: Error: could not stat active Xcode path '/Volumes/Xcode/Xcode45-DP1.app/Contents/Developer'. (No such file or directory)

答案 1 :(得分:2)

我将假设您正在运行Mavericks,在这种情况下,对Ruby进行了一些更改。 This gist稍微过时,但您可以尝试的步骤是......

步骤1)确保您拥有最新版本的Xcode,因为现在命令行工具已随其打包。 (截至2013年10月23日,那将是版本5.0.1)。

步骤2)在终端...

中运行以下每个命令
sys_rb_usr=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sdk_rb_usr=`xcode-select -p`/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sudo cp -r $sdk_rb_usr/include $sys_rb_usr/include

然后再次尝试运行sudo gem install cocoapods

希望有所帮助。

- 更新 - :我在运行Mavericks和Xcode 5.0时遇到了同样的错误消息。将Xcode更新为5.0.1后,我能够将Cocoapods更新为0.26.2。您不必运行上述命令。