Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sandboxing issue in Xcode Run Script Phase

I have a swift script that reads some files to run some checks on them but I get an error that states: Error Domain=NSCocoaErrorDomain Code=257 “The file “Extensions” couldn’t be opened because you don’t have permission to view it.”

The file exists and has standard permissions, all that has changed is that the script has been compiled on macOS 10.14 instead of macOS 10.13. Also the sandboxing entitlement is not applied to it. Is there any known issue with sandboxing when running a script from a Run Script build phase?

If I simply cat the Extensions file, then it prints the contents out in the log correctly.

like image 879
Jonathan. Avatar asked Oct 28 '22 02:10

Jonathan.


1 Answers

Change read/write access to the particular folder. Please follow this link

macOS User Guide (Apple) -> Change permissions for files, folders or disks on Mac

Or try this

You might try looking in SystemPreferences > Security&Privacy > Privacy tab. From there, scroll down to "Files and Folders" <-- There's where you can see programs and the folders they have been granted access to in Catalina.

Personally, I didn't have time to waste figuring out how the new file permissions are supposed to work, so I let Xcode have full disk permission. (Right above the "files and folders" is "Full Disk Access".

like image 122
sDev Avatar answered Oct 31 '22 09:10

sDev