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

<pre><code> - sudo gem uninstall cocoapods
 - sudo gem install cocoapods
</code></pre>

<p>I get the error:</p>

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

<p>Did go through ALL the solutions mentioned by the Gurus under the issue
<a href="https://github.com/CocoaPods/CocoaPods/issues/3736" rel="noreferrer">https://github.com/CocoaPods/CocoaPods/issues/3736</a></p>

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

<pre><code>sudo gem install -n /usr/local/bin cocoapods
</code></pre>

<p>tried modifying the permissions etc as per the solutions provided in the above link and the SO link</p>

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

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

<p>I have also raised a issue on</p>

<pre><code>https://github.com/CocoaPods/CocoaPods/issues/5232
</code></pre>