LoginSignup
1
1

More than 5 years have passed since last update.

Proxy環境下でのCocoaPodsの導入

Last updated at Posted at 2018-11-01

 開発環境

OSX 10.14.1 (Mojave)
Xcode 10.1

CocoaPodsのインストール

ターミナルで以下のコマンドを打つ

$ sudo gem install cocoapods

すると次のエラーが出た

ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ -::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org/specs.4.8.gz)

調べてみると、sudoするときはユーザー環境変数が引き継がれないらしい。
Proxy の環境設定を引き継ぐようにする

$ sudo visudo

visudoはsudo権限を変更するコマンドらしい。上記のコマンドを打つと、vimで編集できるようになる。
以下を追記する

Defaults    env_keep += "http_proxy https_proxy"

どこに追記するかは見ればわかる。
保存したら、もう一度

$ sudo gem install cocoapods
Fetching: cocoapods-1.5.3.gem (100%)
Successfully installed cocoapods-1.5.3
Parsing documentation for cocoapods-1.5.3
Installing ri documentation for cocoapods-1.5.3
Done installing documentation for cocoapods after 3 seconds
1 gem installed

となり、うまくいった。

インストールがうまく行ったので次に以下のコマンドを打って終了

$ pod setup

参考

1
1
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
1
1