I have this script:

#!/usr/bin/env osascript
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer" to keystroke "q" using {command down, control down}
end tell

It needs assistive access. It seems I have to enable this access for the whole terminal application (iTerm2 in my case) to get it to work. This seems like giving a lot of privilege to iTerm. What are the security implications? Is there a workaround?

  • I've been using OS X/macOS for 13 years and have never had an issue giving any application accessibility access. I have never had a malicious incident in doing so and I have hundreds of script and services I created and used over the years! That said thought, anytime one opens a door there is potential for malicious access through that opening; however, I'm not going to worry about it as I only run trusted apps and do not run apps that have not been vetted. I also use Virtual Machines for anything I'm not 100% sure of. I have multiple secure backups and a recovery plan for worst case scenario. Commented Aug 16, 2019 at 16:01

1 Answer 1


"Is there a workaround?" I'd call it the "right" way.

Use the script editor. save the script as an application. Thus, the script becomes a full fledged application. Give the app assertive capabilities. should you want to start the app from the terminal, open your-app.

What to worry about: "Effective defenses against malware and other threats" by John Galt https://discussions.apple.com/docs/DOC-8841

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .