CocoaPods is the dependency manager for Cocoa projects. It has thousands of libraries and can help you scale your projects elegantly.
CocoaPods is built with Ruby and is installable with the default Ruby available on OS X. We recommend you do this.
Using the default Ruby install will require you to use
sudo when installing
gems. Further instructions are in the guides.
$ sudo gem install cocoapods
We currently have Swift support in a beta release.
Search for pods (above). Then list the dependencies in a text file named
Podfile in your Xcode project directory:
source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' pod 'AFNetworking', '~> 2.0' pod 'ARAnalytics', '~> 2.7'
Tip: CocoaPods provides a
pod init command to create a Podfile with
smart defaults. You should use it.
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.:
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 guide for getting started on the CocoaPods tool. It’s easy and really gratifying to contribute patches! - for a lot of people it's their first foray into Open Source. We are also planning to work with Google's Summer of Code 2015, you should participate!