3.16 解決辦法
使用SSH
配置github SSH
git config --global user.email "zhenghan1221@163.com"
創建公鑰密鑰,保存路徑默認,直接按Enter鍵,輸入密碼同樣Enter鍵
ssh-keygen -t rsa -C "zhenghan1221@163.com"
前往文件夾 /用戶/qiyong/.ssh,找到id_rsa.pub文件,使用文本編輯打開后,全選復制,然后登陸GitHub賬戶,在設置中找到SSH和GPG密鑰,選擇New SSH Key新建密鑰,將復制的內容粘貼進去,Add創建成功。
在終端中下載
cd ~/.cocoapods/repos git clone git@github.com:Cocoapods/Specs.git master
然后執行命令
rm ~/Library/Caches/CocoaPods/search_index.json
再pod search 就可以了。
pod 更新和安裝采用以下命令
pod install --verbose --no-repo-update pod update --verbose --no-repo-update
轉為SSH,其實和直接使用http,或者下載好資源再拷貝到~/.cocoapods/repos目錄下的解決辦法,并沒有什么區別。
注意:可使用命令查看當前的請求方式
git remote -v
3.8號的時候,好多app 因使用熱修復而收到警告,盡管我還沒有收到郵件警告,但這個問題既然那么多人遇到了,咱還是及時把Hotfix清除掉吧,于是由此引發了一系列問題。在此以作記錄,方便以后查閱。3.15仍無法解決SSL證書問題,于是以http替代https
qimatoMacBook-Pro:~ qiyong$ gem sources -l *** CURRENT SOURCES ***https://gems.ruby-china.org qimatoMacBook-Pro:~ qiyong$ gem sources --add http://gems.ruby-china.org/ --remove https://gems.ruby-china.org http://gems.ruby-china.org/ added to sourceshttps://gems.ruby-china.org removed from sources qimatoMacBook-Pro:~ qiyong$ gem sources -l *** CURRENT SOURCES *** http://gems.ruby-china.org/ qimatoMacBook-Pro:~ qiyong$ sudo gem install -n /usr/local/bin cocoapods qimatoMacBook-Pro:~ qiyong$ pod setup
3.15 以下嘗試均失敗!首先是pod update 失敗,于是我就去更新pod ,然后在pod setup時遭遇一下錯誤:
fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': Server aborted the SSL handshake[!] CocoaPods was not able to update the
master
repo. If this is an unexpected issue and persists you can inspect it runningpod repo update --verbose
rvm升級
在這一過程中我也走了彎路,沒能準確的找到問題的根源所在,于是查看了下ruby的最新環境2.3.0 當時我的rvm是1.27的版本,于是我直接去更新ruby,遭遇錯誤:
于是,對rvm進行升級,
\curl -sSL https://get.rvm.io | bash -s stable
$curl -L get.rvm.io | bash -s stable
載入rvm 環境
$source ~/.rvm/scripts/rvm
或者在當前的窗口中繼續輸入
$rvm update
然后查看rvm的版本就可知道是否真的安裝成功
$rvm -v
使用rvm對ruby進行升級
查看ruby的最新版本$rvm list known
安裝rubyrvm install 2.4.0
設置默認版本,可以用這條命令來完成$ rvm use 2.4.0 --default
查看已安裝的ruby$ rvm list
卸載一個已安裝ruby版本$ rvm remove 2.4.0
在這一過程中,rvm install 2.4.0時遇到上面圖片所展示的問題二,這時我再次查看,注意到了這樣的描述:
Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch
問題來了:macPorts的問題如何解決?
打開鏈接:https://www.macports.org/install.php ,選擇當前系統對應的macports即可,下載完成后點擊安裝。
之后再打開終端新窗口,執行ruby的升級命令即可。ruby升級之后,我再次對pod升級,問題依舊:
fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': SSLRead() return error -9806[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progressCloning into 'master'...fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': SSLRead() return error -9806
這個時候我才意識到問題的根本所在,原來是SSLread的錯誤
查閱資料說是SecureTransport后端使用的curl。
資料中使用到了以下命令:
$ brew remove git $ brew remove curl $ brew install openssl $ brew install --with-openssl curl $ brew install --with-brewed-curl --with-brewed-openssl git
我在終端中輸入了一下brew list,告訴我該命令不可用,原來我的電腦并沒有安裝Homebrew
Homebrew安裝
命令如下
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
在這一過程中遇到如下問題描述:
于是我將github的HTTPS轉為SSH
在Terminal中輸入以下命令即可$git remote set-url origin git@github.com:USERNAME/OTHERREPOSITORY.git
完成之后打開新窗口再次安裝brew,
這次成功了,之后就是執行brew install openssl
完成后繼續執行brew install --with-openssl curl
最后再次執行命令brew install --with-brewed-curl --with-brewed-openssl git
至此,打開新窗口,再次pod setup就成功了。
個人猜測,不知道是否將github的HTTPS轉為SSH,即可pod setup成功,當時沒有想到這點去嘗試一下。
rvm pkg install openssl2.rvm install 2.3.0 --with-openssl-dir=/Users/milai/.rvm/usr (加粗的代表 第一步安裝openssl的文件目錄)
3.14全部卸載,從頭開始,使用brew安裝了openssl后,繼續使用brew安裝ruby ,依然失敗 此時系統中的ruby 仍為2.0.0,我想應該是缺失了將brew安裝的ruby拷貝到系統中去。
此方式失敗。
而后重裝rvm 安裝ruby采用的以下方式:
此方式仍舊失敗。
官網中說參考這個鏈接中
(https://github.com/huacnlee/init.d/blob/master/install_rvm)
的方式 正確安裝gem/ruby,但我不知道究竟是哪一步出錯。
看過了這篇文章
http://www.lxweimin.com/p/b64b4fd08d3c
很多人說他們的問題解決了,但我一開始就是正確的安裝姿勢,16年,包括17年2月份更新時都是可以的,沒問題的,3月10號時再次更新,就出錯了。SSL問題到現在也沒找到正確的解鎖姿勢。
另有解決辦法,起初有嘗試過,亦然失敗。
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
這是兩篇關于解決ruby的openSSL問題的文章:
https://ruby-china.org/topics/28575
http://www.lxweimin.com/p/dc0b99226b83
嘗試過,在make這一步出現問題。
解壓:tar -xzvf ruby-2.4.0.tar.gz
參考鏈接:
1.ruby更新: http://charsdavy.github.io/2016/09/03/mac-ruby-update/
2.輕松幾步搞定CocoaPods修復10.11不能安裝問題http://www.lxweimin.com/p/9fd6d9ddf4ca3.Mac
3.升級到10.11 出現的問題和解決方法
http://www.lxweimin.com/p/02b74ad2787c
4.http://stackoverflow.com/questions/39434447/unable-to-setup-pods-error-rpc-failed-curl-56-sslread-return-error-9806
5.在SSH和HTTPS之間切換https://help.github.com/articles/changing-a-remote-s-url/
6.http://blog.sina.com.cn/s/blog_bb5a48430102w9j3.html
7.Homebrew安裝 https://brew.sh/index_zh-cn.html
8.http://www.lxweimin.com/p/dc0b99226b83
9.CocoaPods 的簡單快速安裝方法