The Trick to Working with CocoaPods on a Team

On one of the teams I’ve worked on, we had a lot of problems with installing CocoaPods. Team members had different versions of the cocoapods gem installed, and when someone ran pod install, it would mess things up for others.

We ended up having to delegate one person to install CocoaPods, and just push them up with our project to Github for us to use. That was obviously not very scalable or pleasant for us or that one person.

I mentioned this problem to @NeoNacho, a core contributor to CocoaPods and many other build tools, and he offered the much-needed solution. Use a Gemfile!

You can specify which version of the cocoapods gem to use in a Gemfile:

Make sure each team member runs bundle install just once when you make an update to your Gemfile to actually install the correct version of the gems.

After that just run bundle exec pod install to install new CocoaPods – this will ensure the the pods are installed with the version of cocoapods gem specified in your Gemfile.

Thanks @NeoNacho for the great tip!

Update: For more information on how to work with the Gemfile in your project, check out this great Cocoapods Guide on Using a Gemfile. Thanks @orta!

Update 2: @kylefuller pointed out a Pod Version Manager he wrote! Looks useful if you can get the whole team onboard!

Enjoy the article? Join over 20,000+ Swift developers and enthusiasts who get my weekly updates.