Aws-sdk-ios: PhaseScriptExecution failed with a nonzero exit code

Created on 20 Sep 2018  Â·  50Comments  Â·  Source: aws-amplify/aws-sdk-ios

I have recently updated the Xcode to 10.0 and after that I'm unable to create archive. This is log I get

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/muhammadsajad/Library/Developer/Xcode/DerivedData/ySkolar-cizrgcsvnlwnczdicazrfqwbihhi/Build/Intermediates.noindex/ySkolar.build/Debug-iphoneos/ySkolar.build/Script-9E682694EA2C01ECB09BB0EB.sh (in target: ySkolar)
cd /Developer/yskolar
/bin/sh -c /Users/muhammadsajad/Library/Developer/Xcode/DerivedData/ySkolar-cizrgcsvnlwnczdicazrfqwbihhi/Build/Intermediates.noindex/ySkolar.build/Debug-iphoneos/ySkolar.build/Script-9E682694EA2C01ECB09BB0EB.sh

mkdir -p /Users/muhammadsajad/Library/Developer/Xcode/DerivedData/ySkolar-cizrgcsvnlwnczdicazrfqwbihhi/Build/Products/Debug-iphoneos/ySkolar.app/Frameworks
rsync --delete -av --filter P .*.?????? --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/muhammadsajad/Library/Developer/Xcode/DerivedData/ySkolar-cizrgcsvnlwnczdicazrfqwbihhi/Build/Products/Debug-iphoneos/AWSCore/AWSCore.framework" "/Users/muhammadsajad/Library/Developer/Xcode/DerivedData/ySkolar-cizrgcsvnlwnczdicazrfqwbihhi/Build/Products/Debug-iphoneos/ySkolar.app/Frameworks"
building file list ... done
deleting AWSCore.framework/_CodeSignature/CodeResources
deleting AWSCore.framework/_CodeSignature/
AWSCore.framework/

sent 142 bytes received 26 bytes 336.00 bytes/sec
total size is 4594021 speedup is 27345.36
Code Signing /Users/muhammadsajad/Library/Developer/Xcode/DerivedData/ySkolar-cizrgcsvnlwnczdicazrfqwbihhi/Build/Products/Debug-iphoneos/ySkolar.app/Frameworks/AWSCore.framework with Identity iPhone Developer: Azaz Mahmood (3QUCUQH7A8)
/usr/bin/codesign --force --sign DD64EAF55BA0B1B97950184C53316C4D74D569C7 --preserve-metadata=identifier,entitlements '/Users/muhammadsajad/Library/Developer/Xcode/DerivedData/ySkolar-cizrgcsvnlwnczdicazrfqwbihhi/Build/Products/Debug-iphoneos/ySkolar.app/Frameworks/AWSCore.framework'
/Users/muhammadsajad/Library/Developer/Xcode/DerivedData/ySkolar-cizrgcsvnlwnczdicazrfqwbihhi/Build/Products/Debug-iphoneos/ySkolar.app/Frameworks/AWSCore.framework: errSecInternalComponent
Command PhaseScriptExecution failed with a nonzero exit code

core question requesting info

Most helpful comment

I had a quite similar problem. Restarting the computer solved the problem.

All 50 comments

I'm having the same issue.. Were you ever able to fix this?

I'm having the same issue.
Xcode 10.0

At that time I had just updated my Mac OS. I wasn’t able to fix this trying everything, restarting Xcode, reinstalling Pods, Cleaning Project and Build Folder. Then I restarted my Mac and the error went away. I’m not sure but it had to do something with not restarting my computer after OS update. That might not be the case as the update didn’t require a restart, so we can say it was some kind of bug getting things twisted.

In addition,

  • I can build and run on simulator.
  • I can't build for device. The above error occurred.
    Mac OS: Mojave.

Okay in my case the problem turned out to be about keychain access. When you are trying to run your app on an actual apple device you are prompted to enter your Mac password to allow keychain access. The first time this happened I accidentally hit "Deny". Once you hit deny you will never be asked to allow keychain access again and have the error above, UNLESS you restart your mac, which fixed the problem.

@sajadkhan are you still having the problem you reported? If so, are you able to provide a minimal sample code project that demonstrates this problem? I'm able to build and archive for all of "Generic", simulator, and device. The most likely problem is some variation on what @baris-cincik pointed out--a local environment issue that is preventing code signing from working as expected.

@cm-wada-yusuke As I noted above, I am able to build for device & simulator, and archive for all, on Xcode 10.

Being unable to build for device is very often a signing issue, which the SDK project, as a CocoaPod, Carthage, or framework dependency, shouldn't impact. Are you able to build your app for device if you remove all references to the AWS SDK? Conversely, are you able to create a barebones app that builds until you add the SDK? That would provide evidence that it's the SDK to blame.

I had a quite similar problem. Restarting the computer solved the problem.

@palpatim
I solved it by restarting my computer. If I encounter similar problems again, I will try to build on skeleton project according to your advice. Thank you.

Thanks for the followups, all. It sounds like this issue is transient, so I'm going to close this. Feel free to open a new issue if you discover repro steps for an issue that cause this issue to recur.

**

Hmm. any fixes for this shit yet?

**

@Liab-1337, do you have consistent repo steps for this issue? If so, please open another issue.

Omg, is this how you guys do issues?? 'oh sounds like a bunch of people have this problem, but since none of them presented me with a working demonstration, I'm gonna just close this up...'

Hi @codeslubber,

sorry to hear that you are running into this issue also. I am reopening the issue. We have been unable to reproduce the issue ourselves, which is why we are asking for repro steps. It is not even clear that this is an issue with the AWS SDK for iOS or rather with Cocoapods.

If you can provide any additional information that would help us to reproduce and debug the issue it would be appreciated.

Having this issue as well.

Thanks @muellerfr, we resolved this yesterday. I will write up an issue about what fixed it for us. In short: we had to tweak the settings so that the unauth'ed account would not be used while waiting for the user account to auth.

@codeslubber that's great news. Please let us know the details, so we can prepare a fix.

Hi @codeslubber, can you share your findings?

Hi @codeslubber, can you share your findings or even just a consistent repo for the issue?

@palpatim I was able to resolve this issue by restarting my computer. By reading the comments I have realized that you people have figured it out. Sorry for the delay I wasn't around.

Just had the same problem. The Xcode error log indicated a permissions error:

…/Xcode/Projects/<project-name>/Pods/Target Support Files/Pods-<project-name>/Pods-<project-name>/Pods-frameworks.sh: Permission ### denied Command PhaseScriptExecution failed with a nonzero exit code

I did a chmod +x to the 'Pods--frameworks.sh', cleaned and rebuilt.

It works OK now.

I have a similar issue and found a solution stackoverflow

Make sure Xcode and apple device are up to date. Restart your mac then build your workspace. When the keychain prompts enter your mac login and then press always allow. This solution worked for me.

Pressing ENTER will not work you have to press (always allow).

In addition,

  • I can build and run on simulator.
  • I can't build for device. The above error occurred.
    Mac OS: Mojave.

I'm having the same issue.

Just had the same problem.
I did it by remove file in Pods -> Targets Support Files -> Pods-_AppName_ -> Pods-_AppName_-frameworks.sh.
And install pod again using pod install.

I had the same problem. In my case, the problem was caused by the difference between the version of Node.js used by Cordova and the version of Node.js used by Xcode.

I had the same issue when I removed Fabric from my project. Just goto Build Phases tab then "Run Script" section and remove Fabric run command from "shell script"

Xcode -> File -> Workspace Setting... -> cut Build System to Legacy Build System. Have Fun

i found this solution and it fix my problem
write this code to terminal:

chmod -R 755 {my_working_folder}

I removed the script from run scripts in build phases, then built my app, and re added my script
cleaning project (ie. removing build folder from Xcode/DerivedData) has caused it I suppose.

None of these solutions helped. Any other ideas?

In my case installing the latest version of Node.js(v10.16.3) solved it.

In my case i just enter password from my mac and press allow always

In my case, I built the project without the script running first. And then re-enabled the script and it worked.

This was the cause of a lot of frustration.

Carthage method, btw

reboot my MAC works for me! Thanks!

I fixed like this : bundle clear and rename and rebuild is Fixed

What worked for me is adding all the framework that I've installed with Carthage in the Project Settings -> General -> Frameworks, Libraries, and Embedded Content.

I was having:
Command PhaseScriptExecution failed with a nonzero exit code
because:
mkdir: third-party: Permission denied
node_modules/react-native/scripts/ios-install-third-party.sh: line 59: cd: third-party: No such file or directory
So i did:
sudo chown -R $(whoami) ~/.npm
sudo chown -R $(whoami) /usr/local/lib/node_modules
This worked for me.

delete pods directory, and pod install

There are many reasons why this issue comes up, well in my case when I trying to run my project it gives me an error because of my mac doesn't give me permission to install pods. So I go my System Preferences -> security and privacy-> Allow Always. That's work for me

Just reboot my mac.
and recompile so error disappear.

Thank you.

in Build Phases select Run script only when installing
it fixed the problem for me

in Build Phases select Run script only when installing
it fixed the problem for me

Work For me!! updating project from Swift 3.2 to 5, Thanks!

Perform the below steps:

Clean the build.
Go to File -> Workspace Settings
In shared workspace settings select "Legacy Build System" in Build System.
Now try to build and run.

XCode 11, Exported from Unity( 2019.2.17f1) Windows, Copied files into Mac(Catalina) .
1) Open your project folder using terminal
2) write and execute -> pod install
3) then -> pod update
4) The main issue is permission so, -> chmod +x MapFileParser.sh
5) -> chmod +x process_symbols.sh

Worked for me.

in Target Build Phases select all of the optional options

invalidate and restart to android studio

Running pod install solved the issue for me

Hey everyone - per the above issue, I noticed that at times, Xcode automatically enters the string {BUILD_VERSION} as opposed to 1 (in the info.plist file) - this will prevent scripts (like incrementing build numbers) from working correctly..

Try this:
Build phases > Add > New Run Script Phase

# Type a script or drag a script file from your workspace to insert its path.
# skip if we run in debug
if [ "$CONFIGURATION" == "Debug" ]; then
echo "Skip frameworks cleaning in debug version"
exit 0
fi

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done

check this ans: https://stackoverflow.com/a/64984008/7825015

Was this page helpful?
0 / 5 - 0 ratings