I'm unable to Build/Archive my project due to an error:
Permission denied
Command PhaseScriptExecution failed with a nonzero exit code
I have tried correcting keychain login as advised by other answers, but it hasn't worked. Please could someone help? Most likely a rookie mistake but means I cannot even simulate my app.
Further details on the error:
PhaseScriptExecution Copy\ Pods\ Resources
/Users/james/Library/Developer/Xcode/DerivedData/trials-fseuxkwjlleukxdxyfgdrujhdwuy/Build/Intermediates.noindex/trials.build/Debug-iphonesimulator/trials.build/Script-8DEE2FC97BFA0D6E636019C4.sh (in target: trials)
cd /Users/james/pCloud\ Drive/3.\ NeuroRecovery\ Ltd/4.\ Products/3.\ NIHR\ Trial\ NHS/v1.0\ -\ Initial\ App/1.\ App\ Delivery/3.\ Source\ Code/1.\ iOS/trials
/bin/sh -c /Users/james/Library/Developer/Xcode/DerivedData/trials-fseuxkwjlleukxdxyfgdrujhdwuy/Build/Intermediates.noindex/trials.build/Debug-iphonesimulator/trials.build/Script-8DEE2FC97BFA0D6E636019C4.sh
/Users/james/Library/Developer/Xcode/DerivedData/trials-fseuxkwjlleukxdxyfgdrujhdwuy/Build/Intermediates.noindex/trials.build/Debug-iphonesimulator/trials.build/Script-8DEE2FC97BFA0D6E636019C4.sh: line 2: /Users/james/pCloud Drive/3. NeuroRecovery Ltd/4. Products/3. NIHR Trial NHS/v1.0 - Initial App/1. App Delivery/3. Source Code/1. iOS/trials/Pods/Target Support Files/Pods-trials/Pods-trials-resources.sh: Permission denied
Command PhaseScriptExecution failed with a nonzero exit code
Edit 17th Dec: thank you @geno-chen & @fantini I have checked & can report the following:
Did you install Cocoapods with sudo: Yes.
I checked the permissions of the files using ls -lh and had the following: -rw-r--r-- 1 james staff 159B 25 Mar 2015 Podfile -rw-r--r-- 1 james staff 1.2K 25 Mar 2015 Podfile.lock drwxr-xr-x 11 james staff 352B 17 Dec 14:03 Pods drwxr-xr-x 52 james staff 1.6K 17 Dec 14:03 trials drwxr-xr-x@ 5 james staff 160B 17 Dec 14:03 trials.xcodeproj drwxr-xr-x@ 5 james staff 160B 17 Dec 14:03 trials.xcworkspace drwxr-xr-x 4 james staff 128B 17 Dec 14:03 trialsTests
I used chmod to modify permissions of the podfiles as below: -rwxr-xr-x 1 james staff 159B 25 Mar 2015 Podfile -rwxr-xr-x 1 james staff 1.2K 25 Mar 2015 Podfile.lock drwxr-xr-x 11 james staff 352B 17 Dec 14:03 Pods drwxr-xr-x 52 james staff 1.6K 17 Dec 14:03 trials drwxr-xr-x@ 5 james staff 160B 17 Dec 14:03 trials.xcodeproj drwxr-xr-x@ 5 james staff 160B 17 Dec 14:03 trials.xcworkspace drwxr-xr-x 4 james staff 128B 17 Dec 14:03 trialsTests
I then Cleaned my Build Folder, restarted but still have the same error.
I fixed the permission problem by running the following command.
chmod +x "Path to .sh"
Please replace ProjectName
with your project name and username
with your username
chmod +x /Users/username/Documents/ProjectName/Pods/Target\ Support\ Files/Pods-ProjectName/Pods-ProjectName-frameworks.sh
You can get the path from your xcode project as explained by step 1 to 3
I've tried @Sawsan method but get no luck even the file is already executable.
Here is the step how I solve it:
1.delete Podfile.lock
2.delete Pods directory
3.delete .xcworkspace file
4.Pod install again
that's it.
give it a try!
I have to own a trial for this solution and I got a proper result.
Follow the step:
1) Open Terminal and set a project path
"pod deintegrate" command executes
2) Then after "pod install" command executes.
I solved by deleting the Pods folder that was committed to the repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With