CocoaPods

CocoaPodsのインストールでだいぶハマって時間かかってしまった。 まずインストールされてるrvmとrubyのバージョンが古かったので、一からクリーンインストールした。これは割愛。

gemのインストール

$ gem install cocoapods -V

cocoapodsのセットアップ

$ pod setup

でいいんだが、とにかく時間がかかる。 verboseオプション付けても途中経過がよく見えず不安。 cocoapodsのソース読んで直接git cloneしてから、pod setupしても大丈夫そうな様子だったので、方針転換。

$ mkdir ~/.cocoapods/repos
$ cd ~/.cocoapods/repos
$ git clone git@github.com:CocoaPods/Specs.git master

cloneが済んでから pod setupしたらあっさり完了。

$ pod setup --verbose

Setting up CocoaPods master repo
  $ /usr/local/bin/git config --get remote.origin.url
  git@github.com:CocoaPods/Specs.git
  $ /usr/local/bin/git remote set-url origin 'git@github.com:CocoaPods/Specs.git'
  $ /usr/local/bin/git checkout master
  Already on 'master'
  $ /usr/local/bin/git rev-parse  >/dev/null 2>&1

Updating spec repo `master`
  $ /usr/local/bin/git pull
  Already up-to-date.
Setup completed (push access)

ふー。

dlopendigest-sha1

pod installしようと思ったら別の問題にぶちあたる。。

dlopen(/Users/me/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin12.0/digest/sha1.bundle, 9): 
Symbol not found: _rb_Digest_SHA1_Finish  Referenced from: /Users/me/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin12.0/digest/sha1.bundle 

http://stackoverflow.com/questions/15218191/loaderror-dlopendigest-sha1-bundle-symbol-not-found-rb-digest-sha1-finish

によれば、rubyインストールからやりなおしとな。。

$ rvm seppuku
$ \curl -sSL https://get.rvm.io | bash -s stable
$ rvm pkg install openssl
$ rvm install 2.1.1 --with-openssl-dir=$HOME/.rvm/usr
$ rvm docs generate-ri
$ gem install cocoapods -V
$ pod setup --verbose

これでok。

Reference

http://d.hatena.ne.jp/TrinityT/20110122/1295685900

追記

rvm pkg はdeprecatedだそうな。。。

$ rvm pkg install openssl
$ rvm install 2.1.1 --with-openssl-dir=$HOME/.rvm/usr

の代わりに

$ rvm autolibs enable

としてhomebrew で opensslを入れておけばよさげ。