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:
- Copied files in build phases: two different script phases copy the same resource file to the output directory.
- Overlapping output files: one target generates
output.logand 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
- Check build phases for duplicate outputs. Open the target's Build Phases and make sure no file appears in more than one phase.
- Examine custom scripts. Review shell script build phases that write to a common location and change their output paths.
- Use unique bundle identifiers. Make sure different targets (for example, the app and its extensions) have unique bundle identifiers.
- Clean and rebuild. Sometimes cleaning the build folder (
Product>Clean Build Folder) and rebuilding is enough. - Try the legacy build system temporarily. As a last resort, go to
File>Project/Workspace Settingsand 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 Component | Common Cause | Suggested Solution |
| Resources files | Duplicate files in "Copy Bundle Resources" | Ensure unique file management in build settings |
| Script Output | Conflicting output from custom scripts | Modify script or output destination |
| Build Artifacts | Overlapping output from different build targets | Configure separate output paths for each target |
| Legacy vs. New Build System | Incompatibility or bugs in the build system | Optionally revert to legacy build system for a test |
Related reading
- Xcode 10b5 - duplicate symbol linker error, can''t compile with Crashlytics
- Xcode 11 backward compatibility UIWindowScene is only available in iOS 13 or newer
- Xcode 11 debugger is extremely slow - A known problem?
- Xcode 12.3 Building for iOS Simulator, but the linked and embedded framework was built for iOS iOS Simulator
- Xcode 14.3 build error unable to initiate PIF transfer session operation in progress?
- Xcode 15 Unable to boot the Simulator
- Xcode 12.4 “Unsupported OS version” after iPhone iOS update 14.7
- Xcode 13.3 beta 3 swift package init shows warning /Library/org.swift.swiftpm/collections.json has been deprecated but dunno how to use new one
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseNo 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 courseData 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.