今天新蘋果機安裝cocoapods,安裝完以後發現怎麼pod search 都沒有用 命令行提示: swhcxp@iosdevmac ~ % pod search Almofire Setup completed [!] Unable to find a pod with name, author, ...
今天新蘋果機安裝cocoapods,安裝完以後發現怎麼pod search 都沒有用
命令行提示:
swhcxp@iosdevmac ~ % pod search Almofire Setup completed [!] Unable to find a pod with name, author, summary, or description matching `Almofire`
然後我重裝homebrew , RVM, Ruby,Cocoapods,都安裝到最新還是沒用
命令行輸入
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
如果raw.githubsercontent.com訪問不了,在/private/etc/Hosts文件中添加:199.232.4.133 raw.githubusercontent.com
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost 0.0.0.0 account.jetbrains.com 199.232.4.133 raw.githubusercontent.com
或者使用國內鏡像安裝
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
如果失敗多試幾次,可能是你的網路問題,安裝完成以後命令行輸入:brew -v ,查看homebrew版本看看是否安裝成功。
RVM安裝
1.命令行輸入命令:
$ curl -L https://get.rvm.io | bash -s stable
2.載入RVM環境
$source ~/.rvm/scripts/rvm
3.查看安裝結果版本
$ rvm -v
使用RVM環境安裝Ruby
1.列出已知版本
$ rvm list known
2.安裝指定ruby版本
$ rvm install 2.3.0
3.查看ruby安裝狀態和版本
$ ruby -v
Cocoapods安裝
升級gem
sudo gem update --system
更換鏡像源
$ gem sources --remove https://rubygems.org/ $ gem sources -a https://gems.ruby-china.com $ gem sources -l
安裝
OS X 10.11之前系統的安裝cocoapods 指令:
$ sudo gem install cocoapods
OS X 10.11以後系統的安裝cocoapods 指令:
$ sudo gem install -n /usr/local/bin cocoapods
提示安裝完成後,查看一下pod版本
pod --version
嘗試刪除~/Library/Caches/CocoaPods/search_index.json重新pod search還是不起作用
最後解決方案:
來源:https://www.cnblogs.com/huaida/p/12701080.html
1, pod repo remove master
2, cd ~/.cocoapods/repos
3, git clone --depth 1 https://github.com/CocoaPods/Specs.git master
4, rm ~/Library/Caches/CocoaPods/search_index.json
5, pod search afnetworking