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 14,500+ Swift developers and enthusiasts who get my weekly updates.

  • Hi Natasha. Thank you for the post. I missed requiring the CocoaPods version when working in a team, so I am the only person that always integrate new pods and updated them. I like your solution, but I thought about it more and IMO my is a little bit better. Check it out

    I’ll deploy it in my team starting next Monday 🙂

  • James Campbell

    Yes 🙂 I’ve used Gemfiles for many years to solve this, they work a treat ! I am currently writing an article on this that I would love to share with you.