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