osx升級到10.10後,用pod install報錯終於解決的方法
先依照這個文章做:http://blog.csdn.net/dqjyong/article/details/37958067
大概過程例如以下:
- Open Xcode 6
- Open Preferences
- Click the
Locations
tab - Change the
Command Line Tools
version toXcode 6.0
- Uninstall
cocoapods
a.$ sudo gem uninstall cocoapods
- Install
xcodeproj
a.$ sudo gem install xcodeproj
- Install
cocoapods
a.$ sudo gem install cocoapods
- Run
pod --version
to verify that it worked
$ sudo gem install cocoapods
時失敗,錯誤信息例如以下:
ERROR: Could not find a valid gem ‘cocoapods‘ (>= 0), here is why: Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://rubygems.org/latest_specs.4.8.gz) ERROR: Possible alternatives: cocoapods
意識是說在官方源中找不到我們須要的源,這時怎麽辦呢,網上找到一篇博客,這樣做的。切換官方源。也即是改變源的獲取地址
這時候我們須要改變 gem source, 參考[4], [5]。
須要在終端中運行例如以下命令:
$ gem sources -l
$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
接下來輸入下面命令:
$ pod setup
This process will likely take a while as this command clones the CocoaPods Specs repository
into ~/.cocoapods/ on your computer. [6]
至此CocoaPods安裝完成。
註: 假設漏掉 "$ pod setup" 命令,而直接運行"$ pod init"
會有類似下面的error信息:
"$ pod init
Setting up CocoaPods master repo
[!] /usr/bin/git clone ‘https://github.com/CocoaPods/Specs.git‘ master --depth=1
Cloning into ‘master‘...
error: RPC failed; result=52, HTTP code = 0
fatal: The remote end hung up unexpectedly
/Library/Ruby/Gems/2.0.0/gems/claide-0.6.1/lib/claide/command.rb:304:in `handle_exception‘: undefined method `verbose?‘ for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/2.0.0/gems/claide-0.6.1/lib/claide/command.rb:284:in `rescue in run‘
from /Library/Ruby/Gems/2.0.0/gems/claide-0.6.1/lib/claide/command.rb:274:in `run‘
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/command.rb:48:in `run‘
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/bin/pod:33:in `<top (required)>‘
from /usr/bin/pod:23:in `load‘
from /usr/bin/pod:23:in `<main>‘ "
以上操作步驟完畢後在進行:$ sudo gem install cocoapods
這時就成功了!
剩下的就是和曾經的一樣在project文件夾下,建Podfile,運行pod install,打開xworkspace等,順利完畢!
!。
參考博客:http://www.cnblogs.com/cwgk/p/3370949.html
osx升級到10.10後,用pod install報錯終於解決的方法