'sudo gem install cocoapods' doesn't w

2020-07-06 04:13发布

问题:

Upgrading from Yosemite to El Capitan seem to have wiped out the already installed CocoaPods. When I pod install Alamofire/SwiftyJson, it says 'Pod command not found', and as per the stackoverflow solutions I uninstalled cocoapods and trying to reinstall it with the commands

 - sudo gem uninstall cocoapods
 - sudo gem install cocoapods

I get the error:

"Could not find a valid gem 'cocoapods' (>= 0) in any repository"

Did go through ALL the solutions mentioned by the Gurus under the issue https://github.com/CocoaPods/CocoaPods/issues/3736

mainly tried this which seem to have worked for many. still doesn't work for me.

sudo gem install -n /usr/local/bin cocoapods

tried modifying the permissions etc as per the solutions provided in the above link and the SO link

http://stackoverflow.com/questions/30812777/cannot-install-cocoa-pods-after-uninstalling-results-in-error?rq=1

Nothing works, EVERYTHING leads to the same error "Could not find a valid gem 'cocoapods' (>= 0) in any repository"

I have also raised a issue on

https://github.com/CocoaPods/CocoaPods/issues/5232

回答1:

I faced the same problem and it was fixed by using the following command

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


回答2:

I struggled with same issue 1 week, finally this works for me

Disable IPv6 and try again with sudo gem install cocoapods --source http://rubygems.org

Issues seems with network

Few more details give on rugby gems forum - https://help.rubygems.org/discussions/problems/31074-timeout-error