macOS Mojave, Automator “Not authorized to send Apple events to System Events.”

后端 未结 13 821
误落风尘
误落风尘 2020-12-24 00:42

After I updated to Mojave, I can no longer use the automator service I\'ve previously been using with the alert below.

  • In Security & Privacy, I already ch
相关标签:
13条回答
  • 2020-12-24 01:09

    UPDATE: Updating to the latest Public Beta (as of 4 August 2018) fixed the issue for me. Prior to this, the issue did persist in all public betas of Mojave.


    Original reply:

    Just wanted to let you know that both myself and another friend are experiencing this exact same problem, with different Automator workflows that use Applescript (different than yours). We have the problem occurring with both manual activation (Finder --> Services --> click item) and with keyboard shortcut activation.

    Even stranger, the workflow performs beautifully when testing inside Automator.

    I've filed a bug report through the Feedback Assistant, and suggest to anyone else who sees this that you do too! Squeaky wheel and all...

    Automator - Permissions error. "The action “Run AppleScript” encountered an error: “Not authorized to send Apple events to System Events.”"

    Automator workflow performing well inside Automator

    0 讨论(0)
  • 2020-12-24 01:10

    I was still having issues sending keystrokes a few months after Mojave was released. For me, weirdly the fix was to go System Preferences -> Security and Privacy -> Privacy Tab -> Unlock the Lock with your password -> Remove (with the minus button) Automator from the list of Apps in the Accessibility Row. Maybe there was something from running the betas that needed to get deleted before my scripts could send keystrokes again.

    Edit: After quitting System Preferences I was getting the alert error again. Re-adding Automator.app to the Accessibility row seems to have fixed this for now.

    0 讨论(0)
  • 2020-12-24 01:14

    This is definitely a part of Mojave's new security framework. In terminal try

    osascript -e 'tell application "Finder"' -e 'set _b to bounds of window of desktop' -e 'end tell'
    

    and you may receive:

    36:42: execution error: Not authorized to send Apple events to Finder. (-1743)
    

    What is supposed to happen on the first execution is the Finder opens a dialog box informing you that terminal is requesting permission to send events to the Finder. If you allow it, then terminal will get added to the Automation page in System Preferences > Security & Privacy > Automation:

    There's two issues that I see at the moment:

    • the implementation of requesting permission for the scripting action appears to be bugged; I've run other scripts that request permission to send events to Safari and the Finder doesn't prompt for permission, it just returns an error.
    • streamlined automation requires some type of mechanism to have the permissions granted a priori; an example would be utilizing AppleScript with Ansible and being unable to preload grants

    Others have written up more extensive information about this:

    • https://www.felix-schwarz.org/blog/2018/06/apple-event-sandboxing-in-macos-mojave
    • https://forums.developer.apple.com/thread/106949

    Hopefully this gets worked out before Mojave ships as it seriously impacts automation capabilities on macOS.

    0 讨论(0)
  • 2020-12-24 01:14

    I had a similar error running AppleScript .app applications. I received the following error:

    Not authorized to send Apple events to Finder. (-1743)
    

    A workaround is to export (File > Export) or save (File > Save As, holding Option key to show Save As) a new Application from the .scpt or .applescript source code. This generates a new .app application, which in my case ran successfully. The initial launch required approval (as well as some subsequent launches), and the application was added as an entry under Settings -> Security & Privacy -> Privacy -> Automation.

    0 讨论(0)
  • 2020-12-24 01:14

    if you don't get something like this when trying to run your apple script, and more over you don't see iTerm in your Automation section in Privacy Setting, then the simplest possible way may help: JUST RESTART your Mac ;) disclaimer: another reason for that situation on my side may be user switching.

    0 讨论(0)
  • 2020-12-24 01:16

    Here is what I did that resolved the issue for me. I went to System Preferences > Security & Privacy > Accessibility (Options on left hand side) > (Enter system password) > Click Automator (or your app you want to enable) and TADA it works.

    0 讨论(0)
提交回复
热议问题