Kurzbefehle ist nicht berechtigt, Tastatureingaben zu senden

Ich habe ein Problem, was mich in den Wahnsinn treibt: ein AppleScript

lässt sich ausführen, dann verliert das ausführende Programm "plötzlich" die Berechrigung und es funktioniert nicht mehr. Ich habe in den Berechtigungen schon allmögliche Programme zu "Bedienungshilfen"

hinzugefügt: SkriptEditor, Kurzbefehle usw.

Das Popup, um die Berechtigung für Automation zu geben, kommt nicht und manuell lassen sich zu Automation keien Apps hinzufügen.


Das Schlimme: ich bekomme es zwar wieder zum Laufen, aber keine Ahnung

wie. Ich lösche die Apps aus den Berechtigungen für Bedienungshilfen und

füge sie wieder hinzu. Manchmal klappt es, manchmal nicht. Manchmal

gehe nur in die Systemeinstellungen rein, ändere nichts und es geht. Es

ist das absolute Chaos.


Ich habe das Internet schon durchwühlt und andere Leute haben das

Problem auch schon in früheren macOS Verisonen gehabt. Aber es scheint

keine Lösung zu geben.

Es ist so random und lässt sich nicht richtig reproduzieren.

Bin echt am verzweifeln. Hat jemand eine Idee, was ich probieren kann?


macOS 26.1, MacBook Pro M3 Max


tell application "Webcam Motion Receiver"
    activate
    tell application "System Events" to key code 9
end tell


Kurzbefehle

„System Events“ hat einen Fehler erhalten: Kurzbefehle ist nicht berechtigt, Tastatureingaben zu senden.


Terminal

osascript -e "tell application \"Webcam Motion Receiver\"" -e "activate" -e "tell application \"System Events\" to key code 11" -e "end tell"
87:98: execution error: „System Events“ hat einen Fehler erhalten:
osascript ist nicht berechtigt, Tastatureingaben zu senden. (1002)


SkriptEditor

error "„System Events“ hat einen Fehler erhalten: Skripteditor ist nicht berechtigt, Tastatureingaben zu senden." number 1002


MacBook Pro 14″, macOS 26.1

Gepostet am 02. Jan. 2026 00:51

Antworten
Frage gekennzeichnet als Höchstrangige Antwort

Gepostet am 21. Jan. 2026 13:09

This error isn’t really “your AppleScript being wrong”. it’s macOS TCC (privacy protection) blocking UI automation. When it happens, System Events can’t send keystrokes anymore and you get:


osascript is not allowed to send keystrokes (1002)


What’s annoying is that it can be random: it works for days, then suddenly fails (especially when the script runs in the background via LaunchAgent, cron, etc.).


What fixed it reliably for me:

  1. Reset Automation once (optional but helps)
  2. Open Terminal and run:
tccutil reset AppleEvents

Then trigger the permission prompt once:

osascript -e 'tell application "System Events" to keystroke "x"'

Click “Allow” when macOS asks.


  1. The real problem: osascript often gets blocked, and you can’t always add it to Accessibility
  2. Even if your main app is enabled in Accessibility, the keystrokes are executed by /usr/bin/osascript, and macOS may block that process with (1002). Sometimes you can’t even add osascript to Accessibility because it’s a system binary.
  3. Workaround that completely avoids the issue: run the keystrokes via a small app (Automator)
  4. Create an Automator “Application” that simply runs:
/usr/bin/osascript /tmp/your_script.applescript

Then add that app to:

System Settings → Privacy & Security → Accessibility

(Apple lets you add normal apps there, even if it refuses system binaries like osascript)


From your Python/LaunchAgent/script, instead of calling osascript directly, launch the Automator app:

open -W -a "YourAutomatorAppName"

After switching to this approach, the (1002) error was gone and the automation stayed stable, even when running in the background.

1 Antwort
Frage gekennzeichnet als Höchstrangige Antwort

21. Jan. 2026 13:09 als Antwort auf Vanyanie

This error isn’t really “your AppleScript being wrong”. it’s macOS TCC (privacy protection) blocking UI automation. When it happens, System Events can’t send keystrokes anymore and you get:


osascript is not allowed to send keystrokes (1002)


What’s annoying is that it can be random: it works for days, then suddenly fails (especially when the script runs in the background via LaunchAgent, cron, etc.).


What fixed it reliably for me:

  1. Reset Automation once (optional but helps)
  2. Open Terminal and run:
tccutil reset AppleEvents

Then trigger the permission prompt once:

osascript -e 'tell application "System Events" to keystroke "x"'

Click “Allow” when macOS asks.


  1. The real problem: osascript often gets blocked, and you can’t always add it to Accessibility
  2. Even if your main app is enabled in Accessibility, the keystrokes are executed by /usr/bin/osascript, and macOS may block that process with (1002). Sometimes you can’t even add osascript to Accessibility because it’s a system binary.
  3. Workaround that completely avoids the issue: run the keystrokes via a small app (Automator)
  4. Create an Automator “Application” that simply runs:
/usr/bin/osascript /tmp/your_script.applescript

Then add that app to:

System Settings → Privacy & Security → Accessibility

(Apple lets you add normal apps there, even if it refuses system binaries like osascript)


From your Python/LaunchAgent/script, instead of calling osascript directly, launch the Automator app:

open -W -a "YourAutomatorAppName"

After switching to this approach, the (1002) error was gone and the automation stayed stable, even when running in the background.

Kurzbefehle ist nicht berechtigt, Tastatureingaben zu senden

Willkommen in der Apple Support Community
Ein Forum, in dem Apple-Kunden sich gegenseitig mit ihren Produkten helfen. Melde dich mit deinem Apple Account an, um Mitglied zu werden.