Decompiler for compiled AppleScript (.scpt) files
Project description
applescript-decompiler
Decompiler for compiled AppleScript (.scpt) files. Parses the Fasd UAS
binary format and reconstructs readable AppleScript source from the bytecode —
including handlers, control flow (if/repeat/try/tell blocks), object
specifiers, and literals.
Built on (and a significant extension of) Jinmo/applescript-disassembler.
Installation
pip install applescript-decompiler
Or from a checkout:
pip install .
Requires Python 3.11+.
Usage
Command line
asdec compiled.scpt
========================================
Function: areaOfCircle
Arguments: none
========================================
if (not ({real, integer} contains class of var_0)) then
error "Radius must be number."
else
end if
return ((var_0 * var_0) * |«class pi »|)
As a library
from applescript_decompiler import decompile_file
source = decompile_file("compiled.scpt")
print(source)
How it works
applescript_decompiler.fasparses theFasd UASserialization format (a port of theFasLoadroutine from the original AppleScript runtime): reference tables, value blocks, records, literals, and embedded bytecode.applescript_decompiler.opcodesknows the 256-entry instruction set and disassembles handler bytecode.applescript_decompiler.decompilerinterprets each handler's instructions against a simulated value stack, emitting AppleScript statements as it goes.
Limitations
Decompilation reconstructs source from bytecode, and some information is discarded at compile time or only meaningful with an application's terminology dictionary. Expect:
- Local variable names are not stored in compiled scripts, so they appear
as
var_0,var_1, … Handler argument names (including typed and destructuring patterns), globals, and properties are recovered. - Labeled parameters of application/scripting-addition commands are not
reconstructed. A command's name is recovered (e.g.
make,display dialog), but its arguments are rendered positionally rather than with theirwith properties/givenlabels. usestatements,propertyinitializers, andscriptobject structure (inheritance, nesting) are not reconstructed; only the handlers they contain are emitted.- Output is per-handler, framed with
=/Function:/Arguments:headers, not a single recompilable file. The handler bodies are valid AppleScript for most inputs; pathological scripts can still leave a stray marker.
A trailing return of the last expression is emitted for every handler (the
compiler stores it as the result), which is harmless but not always present in
the original.
Development
uv sync # install dev dependencies
uv run pytest # run the test suite
The test suite compiles a corpus of AppleScript sources with osacompile
(macOS only) and verifies that decompilation round-trips: output must contain
no unknown markers, balance its blocks, recompile cleanly, and leave no opcode
unhandled.
License
MIT — see LICENSE. Original disassembler © 2017 Jinmo; decompiler extension © 2026 n0kovo.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file applescript_decompiler-1.0.0.tar.gz.
File metadata
- Download URL: applescript_decompiler-1.0.0.tar.gz
- Upload date:
- Size: 42.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53139e15beee6395c8746bb16ef21a536471661e838d0c265b2615dad9096ade
|
|
| MD5 |
602c9820d29d5410968fdbb98aacf59a
|
|
| BLAKE2b-256 |
ddef1102dbc818c15e3c1ccfc49288dfb062671221f6514433db7463f6998b6f
|
Provenance
The following attestation bundles were made for applescript_decompiler-1.0.0.tar.gz:
Publisher:
release.yml on n0kovo/applescript-decompiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
applescript_decompiler-1.0.0.tar.gz -
Subject digest:
53139e15beee6395c8746bb16ef21a536471661e838d0c265b2615dad9096ade - Sigstore transparency entry: 1750103923
- Sigstore integration time:
-
Permalink:
n0kovo/applescript-decompiler@e7c19c420a5457df6dc25d7ca6c31f94a591afe9 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/n0kovo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e7c19c420a5457df6dc25d7ca6c31f94a591afe9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file applescript_decompiler-1.0.0-py3-none-any.whl.
File metadata
- Download URL: applescript_decompiler-1.0.0-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3623588dc5702076f7d01bd7801ea61d0ba550f42e6e5cdee5d1e11c9e2728c7
|
|
| MD5 |
857c1d6c2c7f0d6ff8aa4ec4b3890ae5
|
|
| BLAKE2b-256 |
0cd9057d7fc6f93b82cb212f698da0a0fbdd732779187430a0453387730652d4
|
Provenance
The following attestation bundles were made for applescript_decompiler-1.0.0-py3-none-any.whl:
Publisher:
release.yml on n0kovo/applescript-decompiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
applescript_decompiler-1.0.0-py3-none-any.whl -
Subject digest:
3623588dc5702076f7d01bd7801ea61d0ba550f42e6e5cdee5d1e11c9e2728c7 - Sigstore transparency entry: 1750104019
- Sigstore integration time:
-
Permalink:
n0kovo/applescript-decompiler@e7c19c420a5457df6dc25d7ca6c31f94a591afe9 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/n0kovo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e7c19c420a5457df6dc25d7ca6c31f94a591afe9 -
Trigger Event:
release
-
Statement type: