LoginSignup
2
4

More than 5 years have passed since last update.

macOS SierraにCocoaPodsをインストールする

Last updated at Posted at 2017-01-08

はじめに

iOSアプリの開発で使用されているパッケージマネージャといえば、CocoaPods, Carthage, Swift Package Managerです。
この中のCocoaPodsのインストール、2017/1/9時点でこうやったらできましたというのをメモしておきます。

環境

  • macOS Sierra
  • version 10.12.1

コマンド

成功したときのコマンドです。

$ sudo gem install cocoapods
$ cd ~/.cocoapods/repos
$ git clone https://github.com/CocoaPods/Specs.git master
$ pod setup --verbose
...
Setup completed

ハマった部分

  1. git cloneが何度か通信エラーになった。

    error: RPC failed; curl 18 transfer closed with outstanding read data remaining
    fatal: The remote end hung up unexpectedly
    fatal: early EOF
    fatal: index-pack failed
    

    エラーになっても同じコマンドを実行したらgit cloneに成功した。
    通信エラーは、めげずにリトライする必要があるようです。
     

  2. git clone --depth 1だとpod setup --verboseが失敗した。
    失敗したときのメッセージ

    Updating spec repo `master`
      Performing a deep fetch of the `master` specs repo to improve future performance
        $ /usr/bin/git -C /Users/aaaa/.cocoapods/repos/master fetch --unshallow
    

    --depth 1を指定すると通信が軽くなるのでgit cloneには成功しやすくなりますが、そのあとのpod setupが途中で止まりました。
    Gitのリポジトリは、きちんとクローンしないといけないようです。

メモ

CocoaPodsは/Library/Ruby/Gems/2.0.0/gems/にインストールされます。
以前はMacOSX El CaptanにCocoaPodsをインストールする際は
$ sudo gem install -n /usr/local/bin cocoapods
のようにインストールディレクトリを指定する必要があったようですが、今(2017/1/9)はインストールディレクトリを指定する必要はないようです。

以上です。

2
4
1

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
2
4