動作環境
macOS Sierra バージョン 10.12.6
何が起きたか
MacOS SierraにてSwiftでiOSアプリ開発を進める際、CocoaPodsを使ってオープンソースライブラリをインストールする必要があった。
早速、CocoaPodsの公式サイト(https://cocoapods.org/app)よりダウンロードして展開・インストールを行い、CUIコマンドツールをインストール。
ここまでは完了したのだがその次、
$ pod setup
を実行して初期設定を行いたいのだが、下記のようなエラーが発生する。
$ pod setup
usage: dirname path
Setting up CocoaPods master repo
$ /Users/ユーザー名(人によって違うのでこう書いてます)/Downloads/installer
etc/CocoaPods.app/Contents/Resources/bundle/bin/git -C
/Users/ユーザー名/.cocoapods/repos/master fetch origin --progress
fatal: Unable to find remote helper for 'https'
[!] CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`
というエラーが発生。CocoaPodsのmasterに原因があり?
試したこと
CocoaPodsのGitのmasterを一度削除し、
$ pod setup
をもう一度実行するも同様のエラーをはく
上記のコマンドはhttps://github.com/CocoaPods/Specs をcloneしているだけなので、手動で行うことにした。
git clone https://github.com/CocoaPods/Specs.git /Users/ユーザー名/.cocoapods/repos/master --progress
を実行するが、やはりダメだった。
最終的に解決した方法
CocoaPodsだが、自分のダウンロードフォルダに展開し、そこからApplicationフォルダに移動させていた。その際に、ダウンロードフォルダに入っているCocoaPods.appを消していなかった。
よってこれを削除し、
$ pod setup
を実行すると、
$ pod setup
Setting up CocoaPods master repo
$ /Applications/CocoaPods.app/Contents/Resources/bundle/bin/git -C /Users/ユーザー名/.cocoapods/repos/master fetch
origin --progress
remote: Counting objects: 161, done.
remote: Compressing objects: 100% (148/148), done.
remote: Total 161 (delta 107), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (161/161), 17.60 KiB | 0 bytes/s, done.
Resolving deltas: 100% (107/107), completed with 46 local objects.
From https://github.com/CocoaPods/Specs
8f038f0..6d6fe31 master -> origin/master
$ /Applications/CocoaPods.app/Contents/Resources/bundle/bin/git -C /Users/bitman/.cocoapods/repos/master
rev-parse --abbrev-ref HEAD
master
$ /Applications/CocoaPods.app/Contents/Resources/bundle/bin/git -C /Users/bitman/.cocoapods/repos/master reset
--hard origin/master
HEAD is now at 6d6fe31 [Add] APMServices 1.6.1
Setup completed
$
これでセットアップは完了。
原因
ダウンロードフォルダとApplicationフォルダにアプリの重複があったことが原因だった。