If Xcode shows “Archive failed” when you create an archive, the underlying problem is usually related to code signing, Release build settings, dependencies, build scripts, or framework configuration. Archive uses the Release configuration in many projects, so a project that runs normally in Debug can still fail during archiving.
- Common causes
- Typical situations
- How to identify the real error
- Solution 1: Clean the build folder
- Solution 2: Delete DerivedData
- Solution 3: Check the Release configuration
- Solution 4: Fix code signing
- Solution 5: Refresh dependencies
- Solution 6: Inspect Run Script Build Phases
- Check the archive from the command line
- Notes
- Summary
Common causes
- Incorrect Build Settings for the Release configuration
- Signing certificate or provisioning profile mismatch
- Broken CocoaPods or Swift Package Manager dependencies
- A Run Script Build Phase that fails only during Archive
- Incorrect framework or library search paths
- Files or settings available in Debug but missing in Release
Typical situations
The message usually appears after choosing Product > Archive, often while preparing a build for App Store Connect. “Archive failed” is only a summary message; the real cause is normally an earlier error in the build log.
How to identify the real error
- Open the Report Navigator in Xcode.
- Select the failed Archive operation.
- Find the first error shown in red.
- Check the Release values in Build Settings.
- Review Team, Bundle Identifier, certificate, and provisioning settings in Signing & Capabilities.
Solution 1: Clean the build folder
Stale build artifacts can cause archive failures. Use Product > Clean Build Folder, then try Archive again.
Solution 2: Delete DerivedData
If the build cache may be corrupted, remove DerivedData.
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Restart Xcode, rebuild the project, and run Archive again.
Solution 3: Check the Release configuration
Open Build Settings for both the project and target and compare Debug with Release. Pay particular attention to Framework Search Paths, Library Search Paths, Swift compiler settings, Deployment Target, and any custom build variables.
Solution 4: Fix code signing
If Automatically manage signing is enabled, verify that the correct Team is selected. For manual signing, make sure the distribution certificate and provisioning profile match the app’s Bundle Identifier and the intended distribution method.
Solution 5: Refresh dependencies
For CocoaPods projects, reinstall or update the pods if dependency integration appears broken.
pod install
pod update
For Swift Package Manager, resolve package dependencies again in Xcode and refresh package caches if necessary.
Solution 6: Inspect Run Script Build Phases
Crash reporting tools, CocoaPods scripts, and custom shell scripts can fail during Archive even when normal builds succeed. Check script paths, input files, environment variables, and permissions under Build Phases.
Check the archive from the command line
Using xcodebuild can make the underlying error easier to see in a full log.
xcodebuild -workspace YourApp.xcworkspace -scheme YourApp -configuration Release archive
For an Xcode project that does not use a workspace, use -project instead of -workspace.
Notes
Do not troubleshoot only the final “Archive failed” line. The useful error is usually earlier in the log. Also remember that a successful Debug build does not prove that the Release configuration is correct.
Summary
“Archive failed” in Xcode is a general failure message. Start with the first concrete error in the Report Navigator, then check Release build settings, signing, dependencies, Run Script phases, and build caches. Working through those areas in order usually reveals the actual cause.
