Enabling AppleScript Support on macOS

Enable AppleScript

By default, permissions are required to be granted to allow AppleScript to execute and interact with other apps. Normally, on a local system, this would be done by clicking on the UI popups, but this method does not work on a headless CI job.

Solution

Manually modify the permissions database to inject the necessary permissions. This can be achieved by using the circleci/macos orb - CircleCI Developer Hub - circleci/macos

Example:

- macos/add-permission:
bundle-id: com.apple.Terminal
permission-type: kTCCServiceAppleEvents

The key items to note are that kTCCServiceAppleEvents is the permission type to grant AppleScript the correct privilege. Additionally, the Bundle ID must be the Bundle ID of the app you are calling the AppScript from - in most cases this may be Terminal, but if you are calling it from within your own app then the appropriate Bundle ID needs to be used. 

Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Article is closed for comments.