LoginSignup
4
4

More than 5 years have passed since last update.

最新版のCocoaPodsが入らない

Posted at

CocoaPodsインストールしようとしたらエラーになる

MacOSのリフレッシュしたので再構築しようとしたらつまづいた

$ gem install -n /usr/local/bin cocoapods --pre
ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: tlsv1 alert protocol version (https://rubygems.org/specs.4.8.gz)

OpenSSLのバージョンが古いっぽい

rubyのOpenSSLのバージョンが古い

gemでアクセスするCDNがTls1.2未満をサポートしなくなったのが原因

$ echo -e "require 'openssl'\nputs OpenSSL::OPENSSL_VERSION" > openssl.rb
$ ruby openssl.rb
OpenSSL 0.9.8zc 19 Mar 2015

証明書入れたりするようなトラブルシューティングが以下のリンクで紹介されているが
そこまで面倒なことはしたくないのでシンプルにrubyを更新する

anyenv install

$ git clone https://github.com/riywo/anyenv ~/.anyenv
$ echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(anyenv init -)"' >> ~/.bash_profile
$ exec $SHELL -l
$ anyenv install -l
Available **envs:
  Renv
  crenv
  denv
  erlenv
  exenv
  goenv
  hsenv
  jenv
  luaenv
  ndenv
  nenv
  nodenv
  phpenv
  plenv
  pyenv
  rbenv
  sbtenv
  scalaenv
  swiftenv

rbenv install

$ anyenv install rbenv

~ 省略 ~
Install rbenv succeeded!
Please reload your profile (exec $SHELL -l) or open a new session.

$ exec $SHELL -l
$ rbenv -v
rbenv 1.1.1-39-g59785f6

ruby install

$ rbenv install --list
Available versions:
~ 省略 ~
  2.4.4
  2.5.0-dev
  2.5.0-preview1
  2.5.0-rc1
  2.5.0
  2.5.1
  2.6.0-dev
  2.6.0-preview1
  2.6.0-preview2
~ 省略 ~
$ rbenv install 2.5.1
$ rbenv versions
$ rbenv global 2.5.1
$ exec $SHELL -l
$ ruby --version
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin16]
$ ruby openssl.rb
OpenSSL 1.1.0h  27 Mar 2018

CocoaPods install

$ gem install -n /usr/local/bin cocoapods --pre
$ pod --version
1.5.3

無事cocoapods が入りました、Yay!!!

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4