Xcode 10
Coding Errors
Software Development
Debugging
iOS Development

How to fix the Xcode "Multiple commands produce" error

Codemia Knowledge Hub ·

The "Multiple commands produce" error means two or more steps in your Xcode build write the same output file. Fix it by finding the duplicate: a file listed twice in a Copy Bundle Resources phase, a custom script copying to the same location as another phase, or two targets producing an artifact with the same name and path.

Why Xcode 10 and later report it

The new build system introduced in Xcode 10 (and enhanced in later versions) manages build dependencies as a Directed Acyclic Graph (DAG) and strictly ensures that no two targets produce the same output file. If the build graph finds more than one path producing the same artifact, it stops with "Multiple commands produce". The cause is usually a project misconfiguration, and the error can interrupt the build without a clear hint of what is wrong.

Typical examples:

  1. Copied files in build phases: two different script phases copy the same resource file to the output directory.
  2. Overlapping output files: one target generates output.log and another target in the same workspace generates a file with the same name in the same output directory.

In general, look for:

  • Two targets generating the same output file.
  • Copy resources build phases that list the same file.
  • Custom scripts copying files to the same location.

Steps to resolve it

  1. Check build phases for duplicate outputs. Open the target's Build Phases and make sure no file appears in more than one phase.
  2. Examine custom scripts. Review shell script build phases that write to a common location and change their output paths.
  3. Use unique bundle identifiers. Make sure different targets (for example, the app and its extensions) have unique bundle identifiers.
  4. Clean and rebuild. Sometimes cleaning the build folder (Product > Clean Build Folder) and rebuilding is enough.
  5. Try the legacy build system temporarily. As a last resort, go to File > Project/Workspace Settings and change the build system under the shared workspace settings, to see whether the problem persists.

If the error appeared after recent changes, reviewing or reverting them in version control can also pinpoint the cause.

Issue ComponentCommon CauseSuggested Solution
Resources filesDuplicate files in "Copy Bundle Resources"Ensure unique file management in build settings
Script OutputConflicting output from custom scriptsModify script or output destination
Build ArtifactsOverlapping output from different build targetsConfigure separate output paths for each target
Legacy vs. New Build SystemIncompatibility or bugs in the build systemOptionally revert to legacy build system for a test

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Basis Lab
No course covers this one yet

Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.

Build my course
Data Structures & Algorithms practice on Codemia

Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.

Practice algorithms