无法上班CocoaPods和Yosemite
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了无法上班CocoaPods和Yosemite相关的知识,希望对你有一定的参考价值。
我已经尝试过这个步骤:
- 打开Xcode 6打开首选项
- 单击“位置”选项卡
- 将命令行工具版本更改为Xcode 6.0
- 卸载cocoapods
- 一个。 $ sudo gem uninstall cocoapods安装xcodeproj
- 一个。 $ sudo gem install
- xcodeproj安装cocoapods
- 一个。 $ sudo gem install cocoapods
- 运行pod --version以验证它是否有效
但是当我进行pod安装或pod --version时,我仍然会这样做:
/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>'
如果其他人遇到同样的问题,我这样做是为了解决我的问题:
- 更新宝石
sudo gem update --system
- 卸载xcodeproj
sudo gem uninstall xcodeproj
- 确保选择所有版本
- 卸载了Cocoapods
sudo gem uninstall cocoapods
- 安装xcodeproj
sudo gem install xcodeproj
- 安装cocoapods
sudo gem install cocoapods
- 跑
pod --version to test.
运行这两行将解决您的问题
sudo gem update --system
sudo gem安装cocoapods
我不得不卸载cocoapods的整个依赖链,以使其工作。
for i in `gem list --no-versions`; do gem uninstall -aIx $i; done
见Uninstall all installed gems, in OSX?
许多问题是由于系统范围的ruby安装,它迫使开发人员一直使用“sudo”(好吧,我们做了多少次“sudo gem install cocoapods --pre”)。我最近有同样的问题试图安装预发布版本的cocoapods(权限搞砸了)。所以这是一个适合我的接近。
$ sudo gem uninstall xcodeproj
$ sudo gem uninstall cocoapods
# Let's restore Apple's ruby installation, the following is for Yosemite that has 2.0 ruby by default
$ cd /System/Library/Frameworks/Ruby.framework/Versions
$ sudo rm Current
$ sudo ln -s 2.0 Current
$ brew install ruby
(关闭和打开终端窗口有时会有帮助)
$ which ruby
应该显示/ usr / local / bin / ruby(现在应该指向“local”目录,而不是“/ usr / bin”,如果不适合你,请确保修改路径顺序)
现在你应该能够安装xcodeproj和cocoapods而不使用“sudo”:
$ gem install xcodeproj --pre
$ gem install cocoapods --pre
(我正在使用预发布版本,如果你想使用发行版,只需删除--pre)。
请享用 :)
错误'require': cannot load such file
表示您有一些丢失或损坏的gem包。您可以通过重新安装cocoapods来修复它:
gem uninstall cocoapods # Follow by sudo if necessary
gem install cocoapods --verbose # Follow by sudo if necessary
并确保您的xcodeproj存在:
gem install xcodeproj --verbose # Follow by sudo if necessary
如果没有帮助,请尝试使用较旧的Ruby安装它:
sudo ln -s /Library/Ruby/Gems/1.8/gems/rubygems-update-1.8.12/bin/gem /usr/bin/gem18
sudo gem18 install cocoapods
看到:
您必须先执行此命令:
sudo gem install cocoapods
这将更新所有过时的宝石
以上是关于无法上班CocoaPods和Yosemite的主要内容,如果未能解决你的问题,请参考以下文章
Xcodebuild-由于代码签名错误,Travis CI 无法归档使用 cocoapods 的项目?