Search code examples
macosapplescriptautomator

How to get the itself path for an Automator application?


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:

  • for apple script: POSIX path of (path to me)
  • for javascript: 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?


Solution

  • 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/