Run AppleScript or JavaScript for Automation (JXA). More information: https://keith.github.io/xcode-man-pages/osascript.1.html.
osascript -e "{{say 'Hello world'}}"
osascript -e "{{say 'Hello'}}" -e "{{say 'world'}}"
*.scpt
), bundled (*.scptd
), or plaintext (*.applescript
) AppleScript file:osascript {{path/to/apple.scpt}}
open -b
):osascript -e 'id of app "{{Application}}"'
osascript -l JavaScript -e "{{console.log('Hello world');}}"
osascript -l JavaScript {{path/to/script.js}}