CocoaPods: Package management for iOS & OS X development

Dependency management, library updates, and more for XCode

Using a third party library during development is often a necessity. You can’t (and shouldn’t) always roll your own solution to a problem that has already been solved. Obtaining, installing, and updating these packages is a painful task; not to mention any dependencies the library may have. Following in the footsteps of great package managers like Ruby Gems, aptitude, yum,NuGet (and many more), comes CocoaPods for iOS and OSX development.

CocoaPods is an open source dependency manager for Objective-C projects and XCode. It’s also a repository of open source libraries containing thousands of projects. CocoaPods makes adding, removing, and updating third party libraries a breeze. It will also automatically handle any required dependencies for the libraries as well.

In a nutshell, CocoaPods works by adding a new XCode project to your existing project (combining them into a workspace automatically if needed) to specifically store your external libraries. You then define a Podfile (a list of the libraries you’d like to use along with guidelines for the libraries), tell CocoaPods to install them, and CocoaPods handles the rest. If any of your packages depend on other packages, they will be downloaded and installed for you as well.

Using the Podfile, you can specify many options including which versions of iOS or OS X to target, which devices to include, and even which versions of the libraries to automatically update to - or freeze the version all together. Updating all of your libraries is straightforward. Just run ‘pod update’ from the project folder using terminal and CocoaPods will check all of your packages for available updates that meet your Podfile rules. Removing a library is just as easy, simply remove the line from your Podfile and run ‘pod install’ again to clean it up. With everything held under its own separate project, your workspace stays nice and tidy.

If all of that convenience weren’t enough, the latest release of CocoaPods has just added a breakthrough new feature - Pod Try. Picking a quality library to use with your project is important. It’s a major time suck to hunt down the candidates, download the packages, incorporate them into an XCode project, and test them only to find out it’s garbage or won’t work and do it all over again. With the new ‘pod try’ command, CocoaPods will download the library you want to evaluate into a temporary directory (including any dependencies), search for a demo project in the package, and automatically launch it for you in Xcode. All that’s left for you to do it build/run it and give it a whirl. If it’s no good, just close the project and you’re done with it. If you want it, add it to your Podfile and install it for real. Pretty awesome.


There is a slight learning curve to using CocoaPods and not everyone is comfortable using the command line, but once you’ve used it once it will all make sense and you’ll be hooked. CocoaPods is built with Ruby and installed as a Gem which makes it really convenient to get up and running since your Mac should have Ruby installed out of the box. Full guides and helpful tips for getting started are available on the CocoaPods Guides page.

For finding CocoaPods to install, you can use the built in search on or check out which lets you search in a more visual way but also can be filtered down to libraries which are available as Pods. Now get podding.

Read more of Matthew Mombrea's ByteStream blog and follow Matt on Twitter (@mombrea) and Google+. For the latest IT news, analysis and how-tos, follow ITworld on Twitter and Facebook.

ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon