node-auto-launch icon indicating copy to clipboard operation
node-auto-launch copied to clipboard

AppleScript security issues on macOS Mojave

Open thomvaill opened this issue 5 years ago • 3 comments

  • The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows): macOS Mojave 10.14.5
  • Node version (run node -v): 10.15.0
  • auto-launch version: 5.0.5
  • The options you're passing to auto-launch:
{
      name: 'xxx',
      isHidden: true,
      mac: {
        useLaunchAgent: false // default value
      }
    }
  • Are you using NW.js or Electron?
    • Yes: Electron
    • If you're using Electron, are you using auto-launch from the main process or a renderer process? -> main process

Since the Mojave version of macOS, Apple introduced some advanced security features which prevent auto-launch to execute its AppleScript. The Exception "Not authorized to send Apple events to System Events" is thrown when calling autoLaunch.enable(). Here is an example: https://recatch.io/s/UnDGITjNmLYV

Is there any workaround? I prefer to use the AppelScript method so my app appears in the Login Items menu, which is not the case with LaunchAgent.

Thank you,

thomvaill avatar Jun 04 '19 13:06 thomvaill

If I add the Apple Events entitlement https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_automation_apple-events and notarize my app then it works for me.

aakarim avatar Jan 20 '20 19:01 aakarim

Hello,

I also have this issue, any way of making it work without notarizing the app ?

Thanks

sydney-d avatar Jun 16 '20 19:06 sydney-d

My app is notarized and I have the permission set, but we're still getting this error.

    <key>com.apple.security.automation.apple-events</key>
    <true/>

RobbieTheWagner avatar Oct 12 '20 16:10 RobbieTheWagner