LoginSignup
0
0

More than 5 years have passed since last update.

CocoaPodsのpod installがうまく動かなくなった時に試した事。

Posted at

開発中のアプリが古いCocoaPodsを使っていたため、ずっとversion upしていなかったのですが、
バージョンを上げる必要性が出てきたので、久しぶりにpod installを打ったら以下のようなエラーが出るようになりました。

$ pod install                                                                                    
Unknown option: -C
usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [-c name=value] [--help]
           <command> [<args>]
Unknown option: -C
usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [-c name=value] [--help]
           <command> [<args>]
Setting up CocoaPods master repo
Unknown option: -C
usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [-c name=value] [--help]
           <command> [<args>]
[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `master-1`.
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.

解決法1 CocoaPodsの入れ直し

色々調べた結果、皆様CocoaPodsの入れ直しで治ったと言う報告が多かったのでやってみる事に。

# ファイル削除
rm -rf ~/.cocoapods
rm -rf ~/Library/Caches/CocoaPods

# install
pod setup

installが終わったら pod install実行。
... 治らない ...

解決法2 git のversion up

よくよくログを見ると

usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [-c name=value] [--help]
           <command> [<args>]
Unknown option: -C

思いっきりGitエラーが出ているので、バージョンをあげます

まず今のGitのバージョン

$ git --version
git version 1.8.0

...これは古い...

https://git-scm.com/ こちらのサイトに行き、最新版をDLしてきます。

再度バージョン確認

$ git --version
git version 2.10.1

うまく上げることが出来ました。
もし、install後でも、バージョンが上がっていなければ、参照しているPathが違っているかもしれません。
古いものは

/usr/bin/git

に入っている可能性があり、新しいものは

/usr/local/git/bin

に入っていますので、bash等のpathを

PATH=/usr/local/git/bin:$PATH
export PATH

としておきましょう。


この後に、再度pod installを実行した所

$pod install
Analyzing dependencies
Downloading dependencies
Installing XXXXXXXX
Installing XXXXXXXX
Installing XXXXXXXX
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 4 dependencies from the Podfile and 4 total pods installed.

無事installに成功しましたヽ(=´▽`=)ノ

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