Home/Q&A/How do I fix AppleScript error -1743, “Not authorized to send Apple events”?

How do I fix AppleScript error -1743, “Not authorized to send Apple events”?

Updated · airankrush

Direct answer

You can fix it yourself. The error means the program that launched the script has not been granted Automation permission to control the target app; turn on the matching switch under System Settings → Privacy & Security → Automation.

Basis

  • Automation permission is recorded in pairs: “program A may control app B”. When you run osascript in Terminal, A is Terminal; launch it from a different terminal program, an editor's built-in terminal or an agent, and A has changed, so permission has to be granted again.
  • The system asks in a prompt the first time control happens. After you click Don't Allow it does not ask again, and every later attempt returns this error. The pair is visible in the Automation list with its switch off; turn it on.
  • If the pair is not in the list at all, the script usually ran for the first time somewhere a prompt cannot appear, such as a remote-login command line or a background job. The fix is to connect to the desktop and run it by hand once in the graphical session with the same launching program, so the prompt shows.
  • Errors that only started after you changed how the script is launched mostly have the same cause: the interpreter or shell the scheduled job calls is not the one you used when testing by hand.

Information as of .

Boundaries: when the answer is different

A common suggestion online is to reset a whole category of privacy permissions with a command. Do not do that on a rented machine: the reset also wipes other programs' records, and if the system permissions the remote-access software relies on are affected, you can lose your connection outright and have to wait for support. For the same reason, do not delete entries you do not recognize from the privacy lists. If the switch is greyed out and cannot be changed, or the same error still appears after you grant permission, send support the full error, how the script is launched and the system version so they can check; a few switches are governed by device management policy, and we do not guarantee all of them can be opened up.

How to do it

  1. Read the target app name in the error, and work out which program launched the script.
  2. Through the remote desktop, open Automation under Privacy & Security, find the launching program and expand the list of apps under it.
  3. If the target app is listed, turn on its switch; if not, go back to the graphical session and run the script by hand once with the same launching program.
  4. Click Allow in the prompt, then run it again to confirm the error is gone.
  5. Finally run it once through the real trigger (the scheduled job or the agent) to confirm the permission is held by the same program.

Use case

This question belongs to the use case: iMessage, AppleScript and Shortcuts on a rented Mac mini: it runs, but Apple decides about your account

Other questions in the same use case:

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · All Q&A