CocoaPods is distributed as a ruby gem, installing it is as easy as running the following commands in the terminal:
$ [sudo] gem install cocoapods $ pod setup
Now that you’ve got CocoaPods installed it’s time to get started.
Search for pods by name and description.
Then list the dependencies in a text file named Podfile in your Xcode project directory:
$ edit Podfile platform :ios pod 'JSONKit', '~> 1.4' pod 'Reachability', '~> 3.0.0'
Now you can install the dependencies in your project:
$ pod install
Make sure to always open the Xcode workspace instead of the project file when building your project:
$ open App.xcworkspace
Now you can import your dependencies e.g.:
How to create a pod
Sometimes CocoaPods doesn’t yet have a pod for one of your dependencies. Fortunately, creating a pod is pretty easy:
$ pod spec create Peanut $ edit Peanut.podspec $ pod spec lint Peanut.podspec
We’re developing CocoaPods on GitHub. There’s a repository for the CocoaPods tool and one for the pods specs. It’s easy and really gratifying to contribute patches or pods, you even get push access when one of your specs or patches is accepted.
Follow CocoaPods on Twitter to get up to date information about what’s going on in the CocoaPods world.
Please report any problems with CocoaPods to the CocoaPods issues page.