'sudo gem install cocoapods' doesn't work on El Capitan 10.11.4 , ERROR: Could not find a valid gem 'cocoapods' (>= 0) in any repository

Naishta picture Naishta · May 1, 2016 · Viewed 13.6k times · Source

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

Answer

Alaa Aljohani picture Alaa Aljohani · Aug 5, 2016

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

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