What is Osascript?

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:






Full Stack Developer | React | JavaScript | Ruby on Rails

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

5 Tips for TypeScript Component Property Interfaces | by Jesse Langford | May, 2022

Create Custom Module in Drupal 9

Laravel Mix Extract And Versioning

Top JavaScript Trends to Watch in 2018

Leetcode: 1748. Sum of Unique Elements — A simple two-step JavaScript solution using a Hashmap

The JavaScript 2022 stack

Easy way to create your first NodeJS server using Express.

Node and express banner

Hoisting demystified with popular interview questions

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Victor Scholz

Victor Scholz

Full Stack Developer | React | JavaScript | Ruby on Rails

More from Medium

The Hardware Initiative (Part 3)

The job takes me to many places I never wanted to visit

‘We support Ukraine’

A Deep Dive into Psychological Disorders