Upgrade from xCode 14.2 to 14.3 PhaseScriptExecution failed with a nonzero exit code

Hello,

I've upgraded from xcode 14.2 to xcode 14.3 beta, and now I can't archive anymore for Any iOS Device (arm64) with the following error :

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks

mkdir -p /Users/max/Library/Developer/Xcode/DerivedData/Max-dmwafkgdrzqavzcmbdjbjgmmuxby/Build/Intermediates.noindex/ArchiveIntermediates/Release_preprod/BuildProductsPath/Release_preprod-iphoneos/MaxApp.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/ActionSheetPicker_3_0.framework" "/Users/max/Library/Developer/Xcode/DerivedData/Max-dmwafkgdrzqavzcmbdjbjgmmuxby/Build/Intermediates.noindex/ArchiveIntermediates/Release_preprod/InstallationBuildProductsLocation/Applications/MaxApp.app/Frameworks"

building file list ... rsync: link_stat "/Users/max/Workspace/MaxApp/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/ActionSheetPicker_3_0.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/9e200cfa-7d96-11ed-886f-a23c4f261b56/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]

Command PhaseScriptExecution failed with a nonzero exit code

Any idea why it works fine with xCode 14.2 and not with xCode 14.3 beta please ?

I tryed to delete the [CP] Embed Pods Frameworks script, but it has re-created it and get the same issue.

I tryed to build and debug in a simulator, and it works fine.

I tryed to delete "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; in the .pbxproj file

  • Thanks to @vadimwe

  • how to fix the same with fastlane builds?

Add a Comment

Accepted Reply

Workaround is to update all the generated ...-frameworks.sh files to add the -f flag to the call to readlink. In other words, need to replace:

source="$(readlink "${source}")"

with

source="$(readlink -f "${source}")"

Seems this is CocoaPods issue...

  • Had the same issue. Solution by @vadimwe worked for me. Thanks a lot!

  • Solution by @vadimwe worked for me! 👍

    in APPNAME/ios/App/Pods/Target Support Files/Pods-App/Pods-App-frameworks.sh replaced source="$(readlink "${source}")" with source="$(readlink -f "${source}")"

  • Nice to help you guys 🫡

Replies

Solution by @vadimwe worked for me! 👍 in APPNAME/ios/App/Pods/Target Support Files/Pods-App/Pods-App-frameworks.sh replaced source="$(readlink "${source}")" with source="$(readlink -f "${source}")"

you don't need to build the code again after you change . Make the change in VS code and then go straight to xcoud > Product > Archive

Was facing the same issue. @vadimwe Thanks a lot for the solution. Is there any way to apply this fix on the cloud build?

Add a Comment

I updated my stackoverflow ticket with more info regarding this problem: https://stackoverflow.com/questions/75486713/upgrade-from-xcode-14-2-to-14-3-phasescriptexecution-failed-with-a-nonzero-exit/75842910#75842910

Add a Comment

Faced the same issue. @vadimwe reply worked for me. Thanks a lot for the solution @vadimwe.

Thanks alot @vadimwe, your solution worked for me.

Finally to avoid this issue please update cocoapods to latest version.

gem install cocoapods --user-install

Worked for me, thanks @vadimwe

Solution by @vadimwe worked for me.

Updating to Cocoapods v1.12.1 resolved this for me.

Had the same issue. Solution by @vadimwe worked for me. Thanks !

Thx @vadimwe ... you helped me out here ;)

@vadimwe 's answer is correct, and I updated my Podfile like this to edit automatically when you run pod install .

post_install do |installer|
  command = <<~EOS
    find . -name *frameworks.sh | tr \\n \\0 |  xargs -0 sed -i -e 's/source="$(readlink "${source}")"/source="$(readlink -f "${source}")"/'
  EOS
  system(command)
end

Yes, this is the solution for now! If anyone is interested, I'm posting the code I put into my node build script AFTER running the 'pod install':

async function replaceInFiles(targetPath, before, after) {
	var command = `unset LANG; find . -type f -name '*' -print0 |xargs -0 sed -i '' 's/${before}/${after}/g'`
	await shell(command, {"cwd": targetPath})
}
.
.
.
//HACK: fix bug in pods installer
			var oldText = "readlink \"${source}\""
			var newText = "readlink -f \"${source}\""
			console.log(`BUG FIX: changing ${oldText} to ${newText} in ${brandTargetFolder}...`)
			await replaceInFiles(`${brandTargetFolder}/platforms/ios/Pods/Target Support Files/Pods-${brand}`, oldText, newText)


The solution of @vadimwe didn't work for me. Still getting error build: Command PhaseScriptExecution failed with a nonzero exit code under RealmJS pod.

  • It used to work for me but today it stopped working. Try running

    flutter run --release

    and see if it gives you other errors. For me, something with up with my provisioning profile and I switched it back to "Automatically manage signing" for Debug, Release and Profile. Then it worked for me.

Add a Comment

I encountered a similar problem, and I found @vadimwe's solution to be effective. I greatly appreciate this. It's important to ensure that you update CocoaPods before implementing @vadimwe's solution.

Thanks @AfsalMe