Apple - revoke forbiddance to send Apple events to System Events

Check setting under: System Preferences > Security & Privacy > Privacy

If you find nothing there, then in Terminal, read the man page for: tccutil

man tccutil

You can use the following command to reset all permissions you've set on AppleEvents:

tccutil reset AppleEvents

Note that after doing so, you'll have to respond to all previous queries that may come forward again.


Note: A few years back there was a project IIRC on GitHub that allowed reading the privacy database and targeting specific occurrences of a set permission, but I think changes in macOS Mojave crippled it. It might be worth doing a bit of googling if you'er looking to target just a specific occurrence of an app permission that is not available in the GUI.


I've hit this issue several times and today I found a solution described @ macobserver by Dave Hamilton, so the credit belongs to Dave.

My setup is:

macOS Mojave, Macport and ohmyzsh, XQuartz

Issue:

As described above, when I run $> gitk, I got same failure (I cannot recall if I was ever been prompted, but this thread makes me believe I could not).

Error in startup script: 58:102: execution error: Not authorised to send Apple events to System Events. (-1743)
    while executing
"exec osascript -e [format {
        tell application "System Events"
            set frontmost of processes whose unix id is %d to true
        end te..."
    invoked from within
"if {[tk windowingsystem] eq "aqua"} {
    exec osascript -e [format {
        tell application "System Events"
            set frontmost of processes ..."
    (file "/opt/local/bin/gitk" line 12261)

The accepted answer from @user3439894 gave me some hope, but I didn't realise until I found Dave's post permissions are divided into groups like Accessibility (the one I was always looking into), and Automation which is where the solution hides.

Fix

  1. Open System Preferences > Security & Privacy > Privacy and there
  2. Select Automation group from the left hand side panel
  3. Spot unchecked Terminal or similar application enter image description here
  4. Check it & close the System Preferences window
  5. Try to run gitk again. Voalà... enter image description here