Permission Denied error in Xcode 10 preventing Build...Command PhaseScriptExecution failed with a nonzero exit code
Solution 1
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
Solution 2
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!
Solution 3
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.
Related videos on Youtube
James LCQ
Updated on October 02, 2022Comments
-
James LCQ over 1 year
I'm unable to Build/Archive my project due to an error:
Permission denied
Command PhaseScriptExecution failed with a nonzero exit codeI 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.
-
Abhilash Shajan over 4 yearsHow to give this permission permenently. In my case permission denied issues is coming each time when a new version of app is building. So I have to execute this command on every new build
-
Leonardo Dias almost 4 yearsSimple and perfect. Worked like a charm. Thank you!
-
Vithani Ravi over 3 yearsWorked like a charm. Thank you
-
Saurav over 3 yearsPerfect solution! Should be marked this as the answer