What commands can be used with the osascript -e argument?

I know of the command osascript -e "set Volume x" where x is 0-7. Is there anything else I can use instead of set or Volume? Or some documentation you could link me to?

1 Answer 1


osascript is a tool to execute AppleScript within a shell/script.

Here is Apple's introductory guide: https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html

Additionally, you can open Script Editor.app (in /Applications/Utilities if your on OS X 10.11). From the menu bar select Window > Library to browse library documentation.

  • so in order to run different osascript commands, I will have to manually make them and save them, then run it with the command?
    – ZomoXYZ
    Nov 12, 2015 at 20:47
  • You can run any AppleScript snippet you would like, ad-hoc or in a saved shell script. Just substitute what is in between the quotation marks with your AppleScript snippet. You can also use Script Editor to create little self-contained applications, scripts, commands, etc. Give the guide a good look - it will answer a lot of questions. Nov 12, 2015 at 20:49
  • Like "willWorkForCookies" said, instead of using "defaults write…" you can: . . . . . . . . . . osascript -e 'tell application "System Events" to tell process "System Preferences" to click checkbox 1 of tab group 1 of window 1' . . . . . . . . . . which will directly change any System setting without re-log-in. Nov 5, 2018 at 11:45

You must log in to answer this question.

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