I'm creating an Application in Mac Automator (MacOs Catalina) that creates a file in the same directory where the .app is.
To get the .app path I'm using:
POSIX path of (path to me)
app.pathTo(this).toString()
It is works great...
... until send the .app to someone in internet.
If the app was download from internet and run, it shows this error
/private/var/folders/.../.../...
read-only file system
How to solve this?
It took me some time to find it out, so I'm creating this Q&A.
It seems that MacOS adds the extended attribute com.apple.quarantine
for downloaded apps. I think apps with this attribute run in some kind of sandbox.
To remove it just run:
$ xattr -r -d com.apple.quarantine my_app.app/