MacOS system permissions for Automation

Quick fix for any Cursor engineer reading this, please add this flag to the .plist file:

<key>NSAppleEventsUsageDescription</key>
<string>This app requires Apple Events access to automate system functions.</string>

Explanation:
I’m working on an Electron.js app for MacOS that uses AppleScript to get the current website URL from Chrome. However when I launch the app through Cursor’s debugger, the app tries to run the AppleScript and fails with this error

{
    NSAppleScriptErrorAppName = "System Events";
    NSAppleScriptErrorBriefMessage = "Not authorized to send Apple events to System Events.";
    NSAppleScriptErrorMessage = "Not authorized to send Apple events to System Events.";
    NSAppleScriptErrorNumber = "-1743";
    NSAppleScriptErrorRange = "NSRange: {123, 5}";
}

This is because the app requires certain Mac system permissions. However those permissions can only be asked for if the executing application has flagged they may be needed. Many people developing automation / agents for MacOS will run into this issue eventually.

Please add the two line fix!

+1 to this issue. I’ve encountered the same Apple Events permission problem in a specific use case:

I have an AppleScript automation that controls Udemy video playback in Chrome while I’m coding along with courses. The script is particularly important because Udemy’s native play/pause button (spacebar) doesn’t work on Mac, making it necessary to use a custom solution.

The exact same script works perfectly in VSCode but fails in Cursor with the error mentioned above.

The script works by finding the Udemy tab in Chrome and toggling video play/pause without requiring Chrome to be the active window. This is crucial for productivity when coding along with video tutorials since it:

  1. Provides a working play/pause functionality that’s broken in Udemy’s Mac implementation
  2. Allows controlling the video while keeping the IDE in focus for coding

Reproduction steps:

  1. Running AppleScript through Shortcuts to control Chrome while Cursor is active
  2. Same automation works flawlessly with VSCode
  3. Fails only when Cursor is the active application