skip to Main Content

For a couple of days, without changing any details on the project, I’ve been receiving this error during the Xcode publishing phase.
I have also shared my code with other developers, and on their computer publishing is not a problem.

Below is the error log:

PhaseScriptExecution [CP] Embed Pods Frameworks /Users/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh (in target 'App' from project 'App')
    cd /Users/[USER_NAME]/Desktop/Workspace/[APP_NAME]/ios/App
    /bin/sh -c /Users/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh

mkdir -p /Users/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/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/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/Build/Intermediates.noindex/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app/Frameworks"
building file list ... rsync: link_stat "/Users/[USER_NAME]/Desktop/Workspace/[APP_NAME]/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/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

Tried to reinstall Capacitor, rebuild the pods, the entire ios folder and project.
Also uninstalled and reinstalled Xcode. I’m always stuck at the same point.

5

Answers


  1. Got the same issue, XCode 14.3 is the issue! Downgrade to 14.2 and it will work. https://developer.apple.com/download/all/?q=14.2

    Login or Signup to reply.
  2. https://github.com/CocoaPods/CocoaPods/issues/11808#issuecomment-1480802886

    Workaround is to update all the generated …-frameworks.sh files to
    add the -f flag to the call to readlink. In other words, replace
    source="$(readlink "${source}")" with source="$(readlink -f
    "${source}")"

    This is my first time contributing to CocoaPods though, so take it
    with a grain of salt!

    Login or Signup to reply.
  3. The answer provided by Baryon Lee worked for me. However for those who are looking for the place where this change has to be applied, you should go to the following path:

    /ios/App/Pods/Target Support Files/Pods-App/Pods-App-frameworks.sh

    And then replace:

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

    with:

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

    Login or Signup to reply.
  4. I use ionic capacitor. I was facing the same issues with MacBook M1 Pro and Xcode 14.3. I downgraded Xcode to 14.2 but it slowed down the build process.

    Then I reinstalled 14.3 and replaced:

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

    With:

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

    And it works. Remember to do this only before doing the Archive.

    Login or Signup to reply.
  5. Since changing the generated files are hard, I wrote a post_install script that does the same workaround mentioned above by others. target name depends on your project such as "App".

    In your Podfile, (ios/App/Podfile) you can add this.

    post_install do |installer|
      installer.aggregate_targets.each do |target|
        if target.name == 'Pods-<Target Name>' # Your target name here
            frameworkPath = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh"
            puts "Found #{frameworkPath}"
            text = File.read(frameworkPath)
            new_contents = text.gsub('readlink "${source}"', 'readlink -f "${source}"') # Detect and replace the line
            File.open(frameworkPath, "w") {|file| file.puts new_contents}
            puts "Updated #{target.name} framework file for xcode 14.3 cocoapods issue"
        end
      end
    end
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search