What is Osascript?

Victor Scholz
2 min readSep 11, 2020

Learning about Osascript started with me wanting to be able to control the play button of Spotify without having to leave my Terminal. I ended up going down a rabbit hole of what’s possible with quality-of-life scripts that you can write on your computer, so I’ll keep it brief and surface level. Here’s a definition from the SS64 website:

“Execute AppleScripts and other OSA language scripts. Executes the given script file, or standard input if none is given. Scripts can be plain text or compiled scripts. Osascript was designed for use with AppleScript, but will work with any Open Scripting Architecture (OSA) language.”

One quick note: if you are seeing a popup on your computer that’s telling you that osascript needs control of your computer, it’s definitely malware and you definitely shouldn’t click accept.

It basically just runs a script from your terminal that you’ve either compiled or typed out with plain text. Compiling a script and simply calling it from your Terminal is definitely what you should be doing, since it’ll allow you to have more functionality, but sometimes laziness takes over. I have a few examples of other commands listed below:

Sourced from: osascript

If you wanted you could also save these as alias shortcuts in your zsh or bash profile. Checkout my first blog post for instructions and give it 50 claps please.

For a fully click free Spotify experience follow these steps:

Source:

https://ss64.com/osx/osascript.html

--

--

Victor Scholz

Full Stack Developer | React | JavaScript | Ruby on Rails