Cocoapods on Mac unable to install “Could not find a valid gem 'cocoapods' (>= 0)”

蹲街弑〆低调 提交于 2019-12-11 16:19:05

问题


I have one office Mac running MacOS 10.13.2 and Ruby 2.2.1 and it is unable to install or run cocoapods via gems. sudo gem install cocoapods returns the error below. I compared the proxy and DNS configuration and it is identical to other macs that can install successfully.

▶ ping https://rubygems.org
ping: cannot resolve https://rubygems.org: Unknown host

What is causing cocoapods installation to fail with the cryptic no such name (https://rubygems.org/specs.4.8.gz) error message?

I tried the answer from this question: 'sudo gem install cocoapods' doesn't work on ElCapitan 10.11.4 , ERROR: Could not find a valid gem 'cocoapods' (>= 0) in any repository

$ sudo gem install cocoapods --source http://rubygems.org

ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why: Unable to download data from https://rubygems.org/ - no such name (https://rubygems.org/specs.4.8.gz) Unable to download data from http://rubygems.org/ - no such name (http://rubygems.org/specs.4.8.gz)


回答1:


The problem was resolved by connecting to a mobile hotspot and updating ruby through that.



来源:https://stackoverflow.com/questions/52076749/cocoapods-on-mac-unable-to-install-could-not-find-a-valid-gem-cocoapods-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!