在跟新Xcode8之后CocoaPods 失效
1.问题:
使用:
bogon:~ zhanglizhi$ vim Podfile
bogon:~ zhanglizhi$ pod install
报错:
Updating local specs repositories
[!] The `master` repo requires CocoaPods 1.0.0 - (currently using 0.39.0)
Update CocoaPods, or checkout the appropriate tag in the repo.
[!] CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`
2.尝试解决:
(1)
bogon:~ zhanglizhi$ pod repo update --verbose
报错:
Updating spec repo `master`
$ /usr/bin/git pull --ff-only
error: Your local changes to the following files would be overwritten by merge:
CocoaPods-version.yml
Please commit your changes or stash them before you merge.
error: The following untracked working tree files would be overwritten by merge:
Specs/0/0/0/CAIStatusBar/0.0.1/CAIStatusBar.podspec.json
Specs/0/0/0/CWNotificationBanner/0.1.0/CWNotificationBanner.podspec.json
Specs/0/0/0/CWNotificationBanner/0.1.1/CWNotificationBanner.podspec.json
Specs/0/0/0/CWNotificationBanner/0.1.2/CWNotificationBanner.podspec.json
Specs/0/0/0/CWNotificationBanner/0.1.3/CWNotificationBanner.podspec.json
Specs/0/0/0/CWNotificationBanner/0.2.0/CWNotificationBanner.podspec.json
Specs/0/0/0/CWNotificationBanner/0.2.1/CWNotificationBanner.podspec.json
Specs/0/0/0/CWNotificationBanner/0.2.2/CWNotificationBanner.podspec.json
Specs/0/0/0/CancellationToken/0.1.1/CancellationToken.podspec.json
Specs/0/0/0/CancellationToken/0.2.0/CancellationToken.podspec.json
Specs/0/0/0/CodeQuickKit/1.0.0/CodeQuickKit.podspec.json
Specs/0/0/0/CodeQuickKit/1.0.1/CodeQuickKit.podspec.json
Specs/0/0/0/CodeQuickKit/1.0.2/CodeQuickKit.podspec.json
Specs/0/0/0/CodeQuickKit/1.1.0/CodeQuickKit.podspec.json
Specs/0/0/0/CodeQuickKit/1.1.1/CodeQuickKit.podspec.json
Specs/0/0/0/CodeQuickKit/1.1.2/CodeQuickKit.podspec.json
Specs/0/0/0/CodeQuickKit/1.1.3/CodeQuickKit.podspec.json
Specs/0/0/0/CodeQuickKit/1.1.4/CodeQuickKit.podspec.json
Specs/0/0/0/CodeQuickKit/1.1.5/CodeQuickKit.podspec.json
Specs/0/0/0/CodeQuickKit/2.0.0/CodeQuickKit.podspec.json
Specs/0/0/0/CodeQuickKit/2.0.1/CodeQuickKit.podspec.json
........
Please move or remove them before you merge.
Aborting
Updating 432723a..b7ab56b
[!] The `master` repo requires CocoaPods 1.0.0 - (currently using 0.39.0)
Update CocoaPods, or checkout the appropriate tag in the repo.
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/sources_manager.rb:258:in `check_version_information'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/sources_manager.rb:224:in `block (2 levels) in update'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:59:in `section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/sources_manager.rb:212:in `block in update'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/sources_manager.rb:211:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/sources_manager.rb:211:in `update'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/command/repo/update.rb:22:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:312:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/command.rb:47:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/bin/pod:44:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
[!] CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`
(2)再次报错后,尝试解决
bogon:~ zhanglizhi$ sudo gem install -n /usr/local/bin cocoapods –pre
报错:
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: cocoapods requires cocoapods-core (= 1.1.1), cocoapods-downloader (< 2.0, >= 1.1.2), cocoapods-trunk (< 2.0, >= 1.1.1), xcodeproj (< 2.0, >= 1.3.3)
(3)再次尝试
bogon:~ zhanglizhi$ gem update cocoapods
报错:
Updating installed gems
Updating cocoapods
Fetching: cocoapods-core-1.0.1.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
bogon:~ zhanglizhi$ Fetching: cocoapods-core-1.0.1.gem (100%)
-bash: syntax error near unexpected token `('
bogon:~ zhanglizhi$ ERROR: While executing gem ... (Gem::FilePermissionError)
-bash: syntax error near unexpected token `('
(4)再次
bogon:~ zhanglizhi$ gem update --system
失败:
Updating rubygems-update
Fetching: rubygems-update-2.6.7.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
3.备注:最后采取删除 卸载Cocoapods
gem sources -l
显示:
*** CURRENT SOURCES ***
https://ruby.taobao.org/
(2).删除
bogon:~ zhanglizhi$ gem source -r https://ruby.taobao.org/
显示:
https://ruby.taobao.org/ removed from sources
(3).替换
gem source -a http://rubygems.org/ to read
显示:
https://rubygems.org is recommended for security over http://rubygems.org/
Do you want to add this insecure source? [yn] y
http://rubygems.org/ added to sources
(4).安装
bogon:~ zhanglizhi$ sudo gem install cocoapods