lipo -remove on each framework during archive builds to strip simulator architectures before submission.Why this happens
When you archive an iOS app for App Store distribution, Xcode embeds all linked frameworks into the app bundle. Many third-party frameworks (especially older ones or those built without Xcode’s modern build system) are fat binaries containing both device architectures (arm64) and simulator architectures (x86_64, i386).
The App Store only accepts device architectures. During validation, Apple’s servers scan every binary inside YourApp.app/Frameworks/ and reject the upload if they find any slice marked x86_64 or i386. This triggers ERROR ITMS-90087: “Unsupported Architecture. Your executable contains unsupported architecture ‘[x86_64, i386]’” along with related errors about segment alignment (ITMS-90209), encryption info (ITMS-90125), and PIE requirements (ITMS-90080).
The root cause is that Xcode’s default Embed Frameworks build phase copies the entire framework bundle as-is, including simulator slices. You must thin each framework to only the architectures listed in ARCHS for the current build destination (arm64 for devices, arm64/x86_64 for simulator).
How to fix it
1. Add a Run Script build phase that strips simulator arches (recommended)
This is the most reliable fix. The script runs only during archive builds (not during regular debug builds), so you can still run on the simulator without re-embedding frameworks every time.
- In Xcode, select your app target (not the framework target).
- Open Build Phases → click + → New Run Script Phase.
- Drag the new phase after “Embed Frameworks” and before “Code Signing”.
- Paste the following script (Shell:
/bin/sh):
# Strip simulator architectures from embedded frameworks during archive builds
# Runs only when TARGET_BUILD_DIR does NOT contain "iphonesimulator"
echo "Target architectures: $ARCHS"
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK; do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Processing $FRAMEWORK_EXECUTABLE_PATH"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")
FRAMEWORK_TMP_PATH="$FRAMEWORK_EXECUTABLE_PATH-tmp"
# Skip if building for simulator
case "${TARGET_BUILD_DIR}" in
*"iphonesimulator"*)
echo "Simulator build — keeping all arches"
;;
*)
# Remove i386 if present
if lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "i386" >/dev/null 2>&1; then
lipo -output "$FRAMEWORK_TMP_PATH" -remove "i386" "$FRAMEWORK_EXECUTABLE_PATH"
echo "Removed i386"
mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
fi
# Remove x86_64 if present
if lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "x86_64" >/dev/null 2>&1; then
lipo -output "$FRAMEWORK_TMP_PATH" -remove "x86_64" "$FRAMEWORK_EXECUTABLE_PATH"
echo "Removed x86_64"
mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
fi
;;
esac
echo "Final: $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")"
done
Why this version is better: It checks TARGET_BUILD_DIR for iphonesimulator and only strips arches for device/Archive builds. This avoids the “slice not found” error on subsequent simulator runs.
2. Alternative: Use xcodebuild -exportArchive with BITCODE_GENERATION_MODE=bitcode (legacy)
If you cannot modify build phases (e.g., CI constraints), you can thin frameworks during export:
xcodebuild -exportArchive
-archivePath YourApp.xcarchive
-exportPath ./Export
-exportOptionsPlist ExportOptions.plist
BITCODE_GENERATION_MODE=bitcode
This forces Xcode to recompile bitcode and drop simulator slices, but it requires bitcode-enabled frameworks and adds significant export time. The Run Script approach is faster and works without bitcode.
3. If you control the framework: Build as XCFramework with only device arches
For framework authors, the cleanest fix is to distribute an XCFramework that only contains ios-arm64 (and optionally ios-arm64_x86_64-maccatalyst for Mac Catalyst). In the framework’s Xcode project:
- Create a new Aggregate target.
- Add a Run Script phase that builds
xcodebuild -create-xcframeworkwith-framework MyFramework.framework -output MyFramework.xcframeworkfor each platform. - Exclude
ios-simulatorfrom the list if you only ship device binaries.
Consumers of your XCFramework will never see ITMS-90087 because the simulator slice simply doesn’t exist.
How to prevent it
- Audit third-party frameworks before adding them: run
lipo -info Framework.framework/Frameworkand verify onlyarm64(andarm64e) are listed. - Prefer XCFrameworks over fat
.frameworkbundles; they enforce per-platform slices. - Keep the stripping script in a shared repo (e.g.,
Scripts/strip-frameworks.sh) and reference it from every app target via"${SRCROOT}/../Scripts/strip-frameworks.sh". - Test on simulator after adding the script — the
caseguard ensures simulator builds remain untouched. - Validate with
xcrun altool --validate-applocally before uploading to catch architecture issues early.
FAQ
Does this script break simulator debugging?
No. The case "${TARGET_BUILD_DIR}" in *"iphonesimulator"*) block detects simulator builds and skips the lipo -remove steps. The framework stays fat (arm64 + x86_64) so the simulator continues to work.
What if my framework is already thin (arm64 only)?
lipo -verify_arch will fail quietly, the if block won’t execute, and the script moves on. No harm done.
Why do I still get ITMS-90087 after adding the script?
Common causes:
– The script runs before “Embed Frameworks” — move it after.
– You’re building a framework target, not the app target — the script must be on the app target that embeds the framework.
– The framework is linked but not embedded — only embedded frameworks are copied into Frameworks/ and scanned by Apple.
Run find "${TARGET_BUILD_DIR}/${WRAPPER_NAME}" -name '*.framework' -exec lipo -info {}/$(defaults read {}/Info.plist CFBundleExecutable) \; after a build to verify every embedded binary shows only arm64.
Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.
