What is '~/Library/Application Scripts'?

Sandboxed apps and most built in apps will automatically create a folder called their package identifier inside ~/Library/Application Scripts and will sometimes break if that directory is unavailable

What purpose does this directory fill, and why do all sandboxed apps automatically try to create a directory named their package identifier com.example.someapp inside? All of the folders inside Application Scripts are empty as far as I can tell


Solution 1:

~/Library/Application Scripts is a directory for apps to run user-supplied scripts. This is largely useful to sandboxed apps, as scripts in this directory gets special privileges to execute outside of the app's sandbox security restrictions. The app can read scripts from the directory, but not write to the directory.

As you might imagine, there aren't that many sandboxed apps that need to execute user-supplied AppleScripts. Also, since this is a directory for user-supplied scripts, only advanced users would probably make use of this directory -- even if they were aware the capability exists for a given app.

References: https://developer.apple.com/documentation/foundation/nssearchpathdirectory/nsapplicationscriptsdirectory

https://developer.apple.com/documentation/foundation/nsuserapplescripttask