When running pod repo update
the following error is generated:
Updating spec repo `master`
[!] Failed to connect to GitHub to update the CocoaPo
Just update cocoapods: sudo gem install cocoapods
use
pod env
rbenv global x.x.x
ruby -v
change ruby version. If not working, watch this rbenv not changing ruby version
check ruby version in the cocoapods env. If not changed,
which pod
make sure your pod path is /usr/local/bin/pod
,if not
export PATH=/usr/local/bin:$PATH
A another solution similar to Max's and Adem's in this thread is found in a CocoaPods issue:
brew install ruby
sudo gem install cocoapods
Verify that you're using the latest and correct Ruby with:
ruby --version
which ruby
Should be using /usr/local/bin/ruby
Reason: It turns out that Github updated to only support TLS 1.2 on Feb 22nd. Older versions of MacOS before High Sierra come preinstalled with Ruby 2.0. This version uses OpenSSL 0.9.8 which "will fail with servers supporting only TLS 1.2."
Updating to the latest Ruby (2.5) and latest CocoaPods (1.4) fixed this for me without having to do anything with openssl (Ruby updates openssl). This is a good solution if you don't want to update to High Sierra just yet.
A slightly simpler solution from Adem's that doesn't use rbenv:
brew install openssl
brew upgrade openssl
brew install ruby
brew link --overwrite ruby
Finally, make sure you don't have your PATH
variable set to have /usr/local/bin
after $PATH
. Your PATH
export in ~/.bash_profile
should look similar to this:
export PATH=/usr/local/bin:$PATH
If someone has these issues on Circle CI I was struggling with this for a day almost.
In the end I think the best way is to use their provided solution to download from their servers.
curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
From this link you can see that one of the cocoapods core contributor says that it's fine: The CocoaPods repo cache is updated roughly every 30 mins, which is usually frequent enough to only miss the last 6 pushes to the Specs repo.
https://discuss.circleci.com/t/best-practice-for-use-of-cached-cocoapods-specs/18897/2
I did next in Terminal:
brew install openssl
if you don't have home brew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
and repeat p.1
export PATH="/usr/local/opt/openssl/bin:$PATH"
openssl version
Output:OpenSSL 1.0.2n 7 Dec 2017
pod update