Resolving Xcode build failures with Swift Package Manager dependencies
Last updated: June 29, 2026
If you're experiencing build failures in Codemagic with Swift Package Manager (SPM) dependencies that work fine locally, this is often related to macro validation issues during the build process.
Common symptoms
Build works locally in Xcode but fails on Codemagic
Error messages related to
ComputeTargetDependencyGraphExplicit dependency errors on SPM packages
Issues with packages like Kingfisher or other third-party dependencies
Solution
Add the -skipMacroValidation flag to your xcodebuild command. This bypasses macro validation that can cause dependency resolution issues in CI environments.
For example, modify your archive command to include this flag:
xcodebuild -workspace YourProject.xcworkspace -scheme YourScheme -archivePath /path/to/archive.xcarchive archive -skipMacroValidation COMPILER_INDEX_STORE_ENABLE=NO
Additional troubleshooting steps
If you continue to experience issues:
Ensure you're using the same Xcode version locally and on Codemagic
Run the xcodebuild command with verbose output (
-v) to get more detailed logsClean your package dependencies and derived data before building
This solution is particularly effective when using Swift macros in your project dependencies.