LoginSignup
23
24

More than 5 years have passed since last update.

cocoapodsのリポジトリ修正

Last updated at Posted at 2015-02-07

pod installの失敗

最近cocoapodsの調子が悪い。
xcodeにライブラリーを入れようとしたらエラーを吐いたのでその対処法を書く。

xcodeからプロジェクトを作って、そのxcodeprojファイルがあるコマンドラインからPodfileを生成。

touch Podfile

とりあえず、AFNetworkingを入れる。

Podfile
platform :ios, "7.0"
pod 'AFNetworking', '~> 2.0'

pod installを行う。

pod install
Analyzing dependencies
[!] There was an error reading '/Users/satoutakeshi/.cocoapods/repos/master/CocoaPods-version.yml'.
Please consult http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/ for more information.

エラーとなってしまった。

エラーの対処法

http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/
を見てみる。

どうやらホームのSpecsリポジトリが壊れてしまったらしい。

libgit2のバグがあり、リポジトリが壊れてしまうらしい。

直し方がコマンドで乗っていた。
$ sudo rm -fr ~/.cocoapods/repos/master
$ pod setup

早速実践。

失敗。

pod setup
Setting up CocoaPods master repo
 [!] There was an error reading '/Users/satoutakeshi/.cocoapods/repos/master/CocoaPods-version.yml'.
Please consult http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/ for more information.

エラーの解消

ここにcocoapodsを入れなおせというアドバイスが書かれていたので試す。
(sinaraとかアンインストールしていたけど自分はしないでやった。)

sudo rm -fr ~/.cocoapods/repos/master
sudo gem uninstall cocoapods
sudo gem update
sudo gem install cocoapods
pod setup

失敗した。
ページをもっと見よう。

どうやらpsychというライブラリーが、あるバージョンがインストールされているとそれが悪さをしてymlファイルが読み込まないそうだ。

(psychはyaml のバックエンドライブラリだそうです。)
悪さをしているバージョンをアンインストールして、別のバージョンをインストールする。

sudo rm -fr ~/.cocoapods
sudo gem cleanup
sudo gem install psych -v 2.0.0
sudo gem uninstall psych -v 2.0.10

もう一度 pod setup をする。

pod setup
Setting up CocoaPods master repo

CocoaPods 0.36.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.

Setup completed

できた!!
やった!

23
24
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
23
24