首页 > 代码库 > 升级Mac os x 10.10+xcode6.1之后,Cocoapods出现问题的解决方案

升级Mac os x 10.10+xcode6.1之后,Cocoapods出现问题的解决方案

在升级Mac OS X 10.10+Xcode 6.1之后,Cocoapods的依赖库管理也相应的进行了升级。目前最新的Release版本是 0.34。在之前的版本中,进行库更新和管理时,会遇到如下错误

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- xcodeproj/prebuilt/universal.x86_64-darwin14-2.0.0/xcodeproj_ext (LoadError)
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:6:in `rescue in <top (required)>'
	from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:3:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj.rb:30:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods.rb:2:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/bin/pod:32:in `<top (required)>'
	from /usr/bin/pod:23:in `load'
	from /usr/bin/pod:23:in `<main>'

解决的方案如下,打开Terminals

1. 卸载 cocoapods

$ sudo gem uninstall cocoapods

2. 安装 xcodeproj

$ sudo gem install xcodeproj

3. 重新安装cocoapods
$ sudo gem install cocoapods

pod setup

4. 检查pod 版本

pod --version

以上的命令执行过程中,如果出现红色字或者黄色的字,说明有错误,需要根据实际情况检查。

可能会遇到一个问题,在执行pod setup和 pod --version时,得到如下错误提示 verify_get_version

Options:

    --silent              Show nothing
    --completion-script   Print the auto-completion script
    --version             Show the version of the tool
    --verbose             Show more debugging information
    --no-ansi             Show output without ANSI codes
    --help                Show help banner of specified command
	from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.34.4/lib/cocoapods/command.rb:129:in `verify_git_version!'
	from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.34.4/lib/cocoapods/command.rb:48:in `run'
	from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.34.4/bin/pod:33:in `<top (required)>'
	from /usr/bin/pod:23:in `load'
	from /usr/bin/pod:23:in `<main>'

解决如下

打开xcode->Preferences->选择 Locaiton->在Command Line Tools中选择 Xcode 6.1,会提示输入sudo密码。

完成之后,回到终端,输入git --version,确认是否1.9版本以上

然后重新安装上述 cocoapods的过程。

升级Mac os x 10.10+xcode6.1之后,Cocoapods出现问题的解决方案