Should we add Pods directory to source control? My take

Ever since CocoaPods was introduced, the debate has raged: should the Pods directory go into .gitignore or get checked into source control?

The creators of CocoaPods say yes. Others disagree, saying it can be regenerated any time, so they prefer to keep the Git repo lean.

Here’s my bold take: it depends. Yes yes, I know, I’m not exactly going out on a limb here, and I’m a few years late to the debate. But let me break it down.

For a standard iOS project: yes, check it in. Most people who clone the repo will be building the project, so having the Pods directory part of the repo:

  • Saves them the step of running pod install
  • Makes builds reproducible, even if CocoaPods is unavailable at the time

If you have so many external dependencies that the repo size becomes unmanageable, that’s a sign you should consider refactoring to remove some of those dependencies.

For a React Native project, no, don’t check it in. Here’s why:

  • Half of the developers cloning the repo will be building Android apps, so they will not need the iOS dependencies
  • React Native brings in a lot of dependencies, and they change frequently. There’s not much you can do about that.

For a Kotlin Multiplatform project: maybe check it in. This is a judgement call based on the number of iOS-specific libraries and how often they change. Hopefully you won’t have too many of these, so that would make the decision easy.