Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission Denied error in Xcode 10 preventing Build...Command PhaseScriptExecution failed with a nonzero exit code

Tags:

xcode

xcode10

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:

  1. Did you install Cocoapods with sudo: Yes.

  2. 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

  3. 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.

like image 729
James LCQ Avatar asked Dec 14 '18 16:12

James LCQ


4 Answers

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

like image 59
Sawsan Avatar answered Nov 10 '22 20:11

Sawsan


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!

like image 42
andrew54068 Avatar answered Nov 10 '22 22:11

andrew54068


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.

like image 16
Priyank Gandhi Avatar answered Nov 10 '22 20:11

Priyank Gandhi


I solved by deleting the Pods folder that was committed to the repo.

like image 1
rsc Avatar answered Nov 10 '22 22:11

rsc