capacitor: 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

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 8
  • Comments: 16 (7 by maintainers)

Most upvoted comments

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 Screenshot 2023-04-03 at 11 18 07 AM

OR wait for the cocoapods new release and follow these steps https://github.com/CocoaPods/CocoaPods/issues/11808#issuecomment-1493930311

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).

closing since CocoaPods 1.12.1 was released with the fix

CocoaPods 1.12.0 -> 1.12.1 It has been shipped!

note: I have been struggling for 3hrs and notice that you should run capacitor update ios after updating cocoapods.

source=“$(readlink -f “${source}”)”

This helped me also. Life saver guys  ☺️

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)

(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…

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