How do I build .ipa files with -skipMacroValidation flag in Codemagic?
Last updated: July 27, 2026
Context
When working with projects that use unsafeFlags (such as those using the Engine framework), the standard xcode-project build-ipa command may not work. Instead, you need to use xcodebuild archive with the -skipMacroValidation flag, followed by proper export commands to generate the .ipa file.
Answer
To build an .ipa file using xcodebuild with the -skipMacroValidation flag, follow these steps in your codemagic.yaml configuration:
First, create the archive using xcodebuild with the -skipMacroValidation flag:
xcodebuild archive \ -workspace YourWorkspace.xcworkspace \ -scheme YourScheme \ -skipMacroValidation \ -archivePath "$CM_BUILD_DIR/output.xcarchive"Then export the archive to create the .ipa file:
xcodebuild -exportArchive \ -archivePath "$CM_BUILD_DIR/output.xcarchive" \ -exportPath "$CM_BUILD_DIR/build" \ -exportOptionsPlist "ExportOptions.plist"
Important notes:
Make sure to specify the complete path to the .xcarchive file, including the .xcarchive extension
Verify that your ExportOptions.plist file exists and is in the correct location
The -archivePath in the export command must match the output path specified in the archive command