bug: Xcode build fails with Command PhaseScriptExecution failed with a nonzero exit code
Bug Report
Capacitor Version
Latest Dependencies:
@capacitor/cli: 4.7.3
@capacitor/core: 4.7.3
@capacitor/android: 4.7.3
@capacitor/ios: 4.7.3
Installed Dependencies:
@capacitor/cli: 4.4.0
@capacitor/core: 4.4.0
@capacitor/android: 4.4.0
@capacitor/ios: 4.4.0
Platform(s)
MacOS Ventura 13.3 with XCode 14.3
Current Behavior
When trying to create new archive using XCode the build fails with the below error
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/alexryltsov/Library/Developer/Xcode/DerivedData/App-gxagovealdxcbabobtkbwqhuaflv/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-2FC07ECF8E24DE592E110C7C.sh (in target 'App' from project 'App')
cd /Users/alexryltsov/Git/BOSS811-MOBILE/release-build-3.0.12/ios/App
/bin/sh -c /Users/alexryltsov/Library/Developer/Xcode/DerivedData/App-gxagovealdxcbabobtkbwqhuaflv/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-2FC07ECF8E24DE592E110C7C.sh
mkdir -p /Users/alexryltsov/Library/Developer/Xcode/DerivedData/App-gxagovealdxcbabobtkbwqhuaflv/Build/Intermediates.noindex/ArchiveIntermediates/App/BuildProductsPath/Release-iphoneos/App.app/Frameworks
Symlinked...
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Capacitor.framework" "/Users/alexryltsov/Library/Developer/Xcode/DerivedData/App-gxagovealdxcbabobtkbwqhuaflv/Build/Intermediates.noindex/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app/Frameworks"
building file list ... rsync: link_stat "/Users/alexryltsov/Git/BOSS811-MOBILE/release-build-3.0.12/ios/App/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Capacitor.framework" failed: No such file or directory (2)
done
sent 29 bytes received 20 bytes 98.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code
Expected Behavior
No error and the build completes successfully
Code Reproduction
The problem started to appear for all iOS native projects after XCode has been upgraded to the latest version 14.3
Other Technical Details
npm --version output:
9.6.1
node --version output:
v18.12.0
pod --version output (iOS issues only):
1.12.0
Additional Context
The problem seems to be caused by this issue and should be fixed in the next CocoaPods release.
The workaround that helps to resolve the problem is discussed here. For Capacitor iOS project the below line in the single file needs to be changed and should look as below

OR wait for the cocoapods new release and follow these steps https://github.com/CocoaPods/CocoaPods/issues/11808#issuecomment-1493930311
Here is the related ticket https://github.com/ionic-team/capacitor/issues/6454
Thanks 👍 @ryaa
Here is the Cocoapods issue for those interested: https://github.com/CocoaPods/CocoaPods/issues/11808
Here is their merged pull request: https://github.com/CocoaPods/CocoaPods/pull/11828 so now we're just waiting for the release of 1.12.1
Thank you @ryaa for opening this issue, it was a lifesaver. Your screenshot was a bit unclear to me. To get it to work for me, line 44 needed to be:
source="$(readlink -f "${source}")"
(no space between the dash and f, and no pipe after it).
(no space between the dash and f, and no pipe after it).
The pipe is the cursor :) and yes, there should be no space, right....
This solution worked for me to get a successful archive and was a lot less intrusive than downgrading xcode or having to manually update a bunch of files one-by-one: https://github.com/CocoaPods/CocoaPods/issues/11808#issuecomment-1496996057
source="$(readlink -f "${source}")"
This helped me also. Life saver guys ☺️
CocoaPods 1.12.0 -> 1.12.1 It has been shipped!
closing since CocoaPods 1.12.1 was released with the fix
Hi, anyone are experience these issue? currently these is the issue that we encounter in our pipeline to generate an ipa file
Processing Info.plist
▸ Running script ‘[CP] Embed Pods Frameworks’
▸ Generating ‘App.app.dSYM’
** ARCHIVE FAILED **
The following build commands failed:
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/runner/Library/Developer/Xcode/DerivedData/App-azlyibamtvkrbhfwntgmcwffjqtw/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh (in target ‘App’ from project ‘App’)
(1 failure)
note: I have been struggling for 3hrs and notice that you should run capacitor update ios after updating cocoapods.
Amazing. it worked for me thanks a lot
I'll see about adding that to our docs if it's not in there.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.