What does the "Run-only" checkbox do in the Script Editor?

AppleScript .scpt files normally contain both the source code (the text you see) and compiled code (the version the computer can immediately run). These two versions are not linked in the file in any way – the file just contains both versions separately. (Text .applescript files only contain source code.)

Normally, when you open a script in Script Editor, it ignores the compiled version and just opens the source. When you save, it compiles the source and saves both versions. "Run-only" means that you are only saving the compiled version, so there's no human-readable version anymore.

You can use run-only script in a few different ways:

  • By running it from the command line:
    osascript /path/to/script
  • By running it from another AppleScript:
    run script "path:to:script
  • By running one of its functions from another AppleScript:
    set myScript to load script
    myScript's myFunc() (or myFunc() of myScript)

Decompiling a run-only script back into source code might be hard, but a compiled script isn't completely obfuscated. During compilation, nouns and verbs are transformed into four-letter codes that AppleScript uses internally. This is easy to reverse: type «class bhit» into Script Editor and click compile → button returned. These four-letter codes can be found scattered around in compiled script files.


"Run-only" saves the script in a run-only mode that disallows opening the script in the editor. If I drag a script exported as Run-only onto the open Script Editor, I get this:

enter image description here