The terminal command osalang list the following installed OSA languages supported by osascript.

Generic Scripting System

Using AppleScript or JavaScript works. For example:

osascript -l JavaScript \
    -e 'Application("iTunes").currentTrack.name()'

However, something like to following returns a "found unknown token" error.

osascript -l 'Generic Scripting System' \
    -e '#!/bin/bash' \
    -e 'echo $HOME'

How does one invoke osascript for 'Generic Scripting System' from the command line for some non-AppleScript, non-JavaScript scripting ... without using any (intermediate) AppleScript or JavaScript? Is this even possible?

2 Answers 2


According to OS X system internals, the "Generic Scripting System" is a generic class to contain the two flavors of scripting supported:

  • AppleScript
  • JavaScript

It's not some third option that adds one or more new dialects, but a container to hold the existing ones. This is indirectly explained in Apple's documentation - they list the two languages and don't mention the wrapper class (or whatever it's proper name is):

If you needed other languages, I would call AppleScript "do shell script..." to then call whatever shell executable that ships by Apple or you have installed (bash, sh, python, swift, perl, ...).

  • 1
    so, apparently, the "Generic Scripting System" listed by osalang is not some gateway beyond the available AppleScript & JavaScript. After your answer, i thought to check the Activity Monitor (information button, Open Files and Ports) with the interactive session osascript -l 'Generic Scripting System' -i. ... the "Generic" interactive goes right to the AppleScript framework resources. Commented Apr 28, 2017 at 0:46

What osalang is actually doing, is talking to the Component Manager and returning all components of type osa (the space at the end is intentional, since this is an OSType aka FourCC). The Component Manager is a software plugin framework which was originally introduced on Classic Mac OS, first for use by QuickTime, and was later heavily used by many Classic Mac OS components, among others Open Scripting Architecture (OSA). In OS X / macOS (and especially so in recent versions), it has been deprecated and is used far less than Classic Mac OS used it, since there are now much better alternatives (such as Objective C classes). The only two things in recent macOS releases that still use Component Manager are OSA and certain audio APIs. (By contrast, in Classic Mac OS it was used for a lot of other stuff, like QuickDraw GX and ColorSync, which have since been replaced by newer technologies.)

So, macOS comes with three osa type components out of the box: ascr (AppleScript), jscr (JavaScript), and scpt (Generic Scripting System). Developers can register additional components to implement further OSA languages, although that is rarely done. What scpt does, is it isn't actually a language, instead it is a programming layer which developers can talk to instead of having to talk directly to the underlying scripting components such as ascr and jscr. Think of it like a middleman, an intermediary. If you look at the macOS SDK, you can find its API declared in OSAGeneric.h which can be found in OpenScripting framework. One of the features it adds to the underlying OSA language components, is routing of .scpt files. Basically, a program (such as osascript or "Script Editor") can call an API (OSALoad) to load a .scpt file. There is a field in the file header or trailer which states which actual scripting language is being used. The Generic Scripting System contains the code to interpret that file header/trailer and then sends the contents of the .scpt file to the appropriate language engine. So, talking to "Generic Scripting System", instead of directly to the underlying language engines, is actually important for developers if they want to support loading .scpt files in any language.

You must log in to answer this question.

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