cocoapodsを2台のMacにインストールしたときに、両方ともスルッといかなかったので備忘録。
cocoapodsのインストール手順
$ sudo gem install cocoapods
$ pod setup
これで下記エラーが発生。
$ zsh: command not found pod
rbenv関連のエラーかな、と思い、
$ rbenv rehash
をしてから再度挑戦。
$ pod setup
Users/kiiita/.rbenv/versions/2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'cocoapods' (>= 0) among 391 total gem(s) (Gem::LoadError)
つらい。。。
ので、再度cocoapodsをインストールし直す。
$ sudo gem uninstall cocoapods
$ sudo gem install cocoapods
CHANGELOG:
## 0.33.1
##### Bug Fixes
* Fix `pod spec lint` for `json` podspecs.
[Fabio Pelosin][irrationalfab]
[#2157](https://github.com/CocoaPods/CocoaPods/issues/2157)
* Fixed downloader issues related to `json` podspecs.
[Fabio Pelosin][irrationalfab]
[#2158](https://github.com/CocoaPods/CocoaPods/issues/2158)
* Fixed `--no-ansi` flag in help banners.
[Fabio Pelosin][irrationalfab]
[#34](https://github.com/CocoaPods/CLAide/issues/34)
Successfully installed cocoapods-0.33.1
Parsing documentation for cocoapods-0.33.1
Done installing documentation for cocoapods after 4 seconds
1 gem installed
$ pod setup
Setting up CocoaPods master repo
Setup completed (read-only access)
無事通りました。
このあと、作業しているxcodeディレクトリに移動して、Podfileを作成していきます。
$ cd /path/to/your/app
$ pod init / Podfileの作成
これで、Podfileが作成されました。
Podfileを開いてみると、下記のようになっています。
$ vim Podfile
# Uncomment this line to define a global platform for your project
# platform :ios, "6.0"
target "YourAppName" do
end
target "TinderLikeAppTests" do
end
あとは、installしたいファイルを記入して、インストールコマンドを打てばOK
# Uncomment this line to define a global platform for your project
# platform :ios, "6.0"
target "YourAppName" do
pod "Hogehoge"
end
target "TinderLikeAppTests" do
end
$ pod install
すると、Podfile.lockなどが生成されます。