Skip to main content
added 597 characters in body
Source Link
user3439894
  • 60.9k
  • 10
  • 117
  • 139

If you run AppleScript code via osascript in Terminal, then you need to add Terminal to System Preferences > Security & Privacy > Privacy > Accessibility, to allow it assistive access.


I took your code, saved it to a file named testcode and made it executable using chmod. I then ran it in Terminal and received the following error:

./testcode:157:286: execution error: System Events got an error: osascript is not allowed assistive access. (-1728)

I then added Terminal to System Preferences > Security & Privacy > Privacy > Accessibility and ran it again. It then processed the script properly and returned:

radio button Login Items of tab group 1 of window Users & Groups of application process System Preferences

It of course opened the System Preferences to that target.

If you run AppleScript code via osascript in Terminal, then you need to add Terminal to System Preferences > Security & Privacy > Privacy > Accessibility, to allow it assistive access.

If you run AppleScript code via osascript in Terminal, then you need to add Terminal to System Preferences > Security & Privacy > Privacy > Accessibility, to allow it assistive access.


I took your code, saved it to a file named testcode and made it executable using chmod. I then ran it in Terminal and received the following error:

./testcode:157:286: execution error: System Events got an error: osascript is not allowed assistive access. (-1728)

I then added Terminal to System Preferences > Security & Privacy > Privacy > Accessibility and ran it again. It then processed the script properly and returned:

radio button Login Items of tab group 1 of window Users & Groups of application process System Preferences

It of course opened the System Preferences to that target.

Source Link
user3439894
  • 60.9k
  • 10
  • 117
  • 139

If you run AppleScript code via osascript in Terminal, then you need to add Terminal to System Preferences > Security & Privacy > Privacy > Accessibility, to allow it assistive access.