由于xcode更新到10,pod不支持,故而要更新pod到最新版1.5.3。在更新的时候,遇到了问题.。执行sudo gem update cocoapods的时候,输出ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:Unable to download data from https://gems.ruby-china.org/ - bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)。遇到这个问题,可能要先更新gem的sources。
1、查看gem的sources
sycarnetMacmini:~ sycarnet$ gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.org/
2、更换gem的sources
sycarnetMacmini:~ sycarnet$ gem sources --remove https://gems.ruby-china.org/
https://gems.ruby-china.org/ removed from sources
sycarnetMacmini:~ sycarnet$ gem sources --add https://gems.ruby-china.com/
https://gems.ruby-china.com/ added to sources
sycarnetMacmini:~ sycarnet$ gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.com/
3、更新gem
sycarnetMacmini:~ sycarnet$ gem update --system
Updating rubygems-update
......
RubyGems system software updated
sycarnetMacmini:~ sycarnet$ gem -v
2.7.7
4、更新pod
sudo gem update cocoapods
5、注意:此时pod更新不了可以尝试先删除pod,再安装
sycarnetMacmini:~ sycarnet$ which pod
/usr/local/bin/pod
sycarnetMacmini:~ sycarnet$ rm -rf /usr/local/bin/pod
sycarnetMacmini:~ sycarnet$ sudo gem install cocoapods
Password:
Fetching: cocoapods-core-1.5.3.gem (100%)
Successfully installed cocoapods-core-1.5.3
Fetching: cocoapods-1.5.3.gem (100%)
Successfully installed cocoapods-1.5.3
Parsing documentation for cocoapods-core-1.5.3
Installing ri documentation for cocoapods-core-1.5.3
Parsing documentation for cocoapods-1.5.3
Installing ri documentation for cocoapods-1.5.3
Done installing documentation for cocoapods-core, cocoapods after 4 seconds
2 gems installed
sycarnetMacmini:~ sycarnet$ pod --version
1.5.3