酢ろぐ!

カレーが嫌いなスマートフォンアプリプログラマのブログ。

Ruby 2.3.0にしてCocoaPods 0.39.0を使ったらpod installでエラーが出た

数ヶ月前に開発で使っているMacBook ProをOS X El Capitan(10.11.3)にしたんですが、当初使えていたXcode 6.4がなにかのキッカケで壊れてしまいました。Xcodeを起動した時にツールバー(?)にスキームや実行するiOSシミュレータを選択する部分が表示されないんですよね……

そこでParallelsで仮想環境を作ってYosemiteをインストールして、Xcode 6.4専用の開発環境を作ろうと思いました。

Xcode 6.4をインストールしたところまではよかったのですが、pod installをしたところライブラリのインストール中にエラーが発生してしまいました。

$ pod install

Updating local specs repositories

CocoaPods 1.0.0.beta.2 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.

Analyzing dependencies
Pre-downloading: `GLDTween` from `https://github.com/theguildjp/GLDTween.git`
Pre-downloading: `SMPageControl` from `https://github.com/Spaceman-Labs/SMPageControl.git`
Pre-downloading: `UIDeviceIdentifier` from `https://github.com/squarefrog/UIDeviceIdentifier.git`
Pre-downloading: `XMLDictionary` from `https://github.com/nicklockwood/XMLDictionary.git`

(中略)

### Error

NoMethodError - undefined method `to_ary' for #<Pod::Specification name="AQSLINEActivity">
Did you mean?  to_query
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/resolver/lazy_specification.rb:14:in `method_missing'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/resolver.rb:64:in `flatten'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/resolver.rb:64:in `block in resolve'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/resolver.rb:63:in `tap'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/resolver.rb:63:in `resolve'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/analyzer.rb:539:in `block in resolve_dependencies'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:59:in `section'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/analyzer.rb:537:in `resolve_dependencies'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/analyzer.rb:70:in `analyze'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:213:in `analyze'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:136:in `block in resolve_dependencies'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:59:in `section'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:135:in `resolve_dependencies'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:105:in `install!'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:71:in `run_install_with_update'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:101:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/claide-0.9.1/lib/claide/command.rb:312:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/command.rb:47:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/bin/pod:44:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

自分のMBPに入っているのは「CocoaPods 0.39.0」と「Ruby 2.2.4」でした。Yosemite仮想環境は「CocoaPods 0.39.0」と「Ruby 2.3.0」でした。

こちらの環境ではエラーが発生せずにライブラリのインストールができていたのでRubyをバージョンアップしたことが原因じゃないかと当たりをつけて、Yosemite仮想環境の方もrbenvを使ってRubyのバージョンを2.3.0から2.2.4に変更したところ、pod installでエラーを吐かなくなりました。

この問題は、どうやらCocoaPodsの次のバージョンでは修正されているようです。

CocoaPods 0.39.0では結構ハマってるので、早く次のバージョンが正式版になってほしいなぁ…と。