Error: Multiple commands produce…, Cocoapods & Multi Platform Podfiles

TL;DR: Remove use_frameworks! from your Podfile.


If you’ve arrived here you probably have a Podfile that includes multiple targets for multiple platforms that share some pods, while using the new Xcode build system.

And you’re almost certainly ready to burn everything to the ground.

Thankfully, I already did that, and out of the ashes a solution emerged, resplendent and angry.

There are a couple of issues:

  1. Xcode is non deterministic with respect to this issue, and will randomly decide whether there is an issue to worry about at all. This is fucking infuriating.

  2. The new build system (randomly, see 1!) doesn't like duplicate things, whereas the legacy build system didn't care.

    When Swift was introduced, it didn’t support static libraries, so we all dutifully added use_frameworks! to our Podfiles. When you have multiple platforms sharing pods, you will have multiple copies of the pod source in your Pods/Target Support Files/ folder, and Xcode will get its knickers in a bunch. Sometimes.

    Swift now supports static libraries.

    Remove use_frameworks! and everything will work.

Ryan Booker @ryanbooker