"Operation Not Permitted" - Cannot get read access from App created with Automator Bash Script

200 Views Asked by At

I am stuck trying to access this specific file from an App I have created with Automator. When the exact same Bash script is run from Terminal, all is dandy. I have checked permissions on the file and they are -rw-r--r--@ (which I recognize is quarantined) and then I remove the xattr so it becomes -rw-r--r--, however it does seem that the attribute does get reapplied at some point (not instantaneous).

The file path is the following:

~/Library/Caches/com.apple.findmy.fmipcore/Items.data: Operation not permitted

and the application I am creating is documented here on github https://github.com/jbobrow/DogWalker

As a quick recap of what I've tried: I tried changing the file permissions. I tried restarting after permission changes. I granted the application full access in System Settings. I tried removing the quarantine attribute from the file...

When the application is run in Automator or with the app, the file isn't accessed so the CSV simply gets a blank line with the date. When I run the same bash script in Terminal, the CSV populates as desired.

I look forward to a possible solution and will be thrilled to give credit in my README.md

1

There are 1 best solutions below

1
Cloudlady On

Do you have selinux enabled? Find out by running getenforce. If it returns "Enforcing" then it could be what is blocking access to the file.

You can disable the enforcement with sudo setenforce 0. To confirm it isn't being enforced, just run getenforce again. It should return "Passive".

You can use sudo setenforce 1 to re-enable. Note these that changes are temporary in that upon next reboot it will go back to the default that is set in the /etc/sysconfig/selinux file.

If you find that selinux is enabled, Google search "how to diagnose selinux issues" for instructions on how to resolve issues.