Quickstart
Install the CLI from npm and compile your first binary in a couple of minutes.
Prerequisites
- macOS 15+ arm64/x64, Linux arm64/x64, or Windows x64 — see platform support for target details.
- Node ≥ 24 and npm — for npm installation. The installed compiler and its native output run without Node. Standalone distributions are also available from GitHub Releases.
- A platform linker and SDK — for executable builds. On macOS, install the Xcode Command Line Tools.
--emit=ir|llvm|asm|objuses bundled tools and needs no external linker or SDK.
Install
$ npm install -g scriptcKeep optional dependencies and installation scripts enabled so npm can install the native command for your platform.
To work from a clone instead (pnpm install && pnpm build in the repo, then pnpm scriptc from the repo directory), see the repository.
Your first binary
Write ordinary TypeScript:
const who: string = process.argv.length > 2 ? process.argv[2] : "world";
console.log(`hello, ${who}`);Compile and run in one step:
$ scriptc run hello.ts
hello, worldOr produce the executable:
$ scriptc build hello.ts -o hello
$ ./hello scriptc
hello, scriptc
$ ls -la hello
-rwxr-xr-x 1 you staff 329752 helloThat is a self-contained native binary — no Node, no node_modules, no JavaScript engine. It starts in about 4ms where Node takes ~35ms to print the same line.
Note the process.argv.length guard in hello.ts: scriptc arrays are dense, so an out-of-bounds read like process.argv[2] with no third argument is a runtime trap, not undefined. This is one of the documented divergences; the compiler and runtime tell you rather than silently differing.
See what compiles
Ask the compiler how static your program is — and what, precisely, isn't:
$ scriptc coverage hello.ts
statements analyzed 2
compile statically 2 (100%)
fully static — this program has no dynamic remainder.For programs that import npm packages or use any, the report names each dynamic site and each blocker with an error code. See Coverage Reports.
Use an npm dependency
npm packages run in an embedded JavaScript engine, opted in with --dynamic:
import pc from "picocolors";
function banner(text: string): string {
return pc.bold(pc.green(text));
}
const args = process.argv.slice(2);
console.log(banner("scriptc demo"));
console.log(`args: ${args.length}`);$ npm install picocolors
$ scriptc build cli.ts --dynamic -o demo
$ ./demo one two
scriptc demo
args: 2The package's JS is embedded into the binary at build time — the executable never reads node_modules and runs from anywhere. See npm Dependencies for how the boundary works.
Next steps
- CLI Reference — every command and flag, including
--emit,--backend llvm, and--sanitize. - Native Program Objects — consume
app.ofrom an external C or linker build. - Platform Support — cross-compiling to Linux and Windows with zig.
- Limitations — what doesn't compile yet.