Quickstart
Install scriptc, compile a TypeScript file, and run the resulting executable.
Prerequisites
- macOS 15+ on arm64 or x64, Linux on arm64 or x64, or Windows on x64. See Platform Support for target details.
- Node.js 24 or later and npm for installation. The installed native compiler and its output run without Node.js. Standalone distributions are available from GitHub Releases.
- A platform linker and SDK for executable builds. On macOS, install the Xcode Command Line Tools. IR, LLVM IR, assembly, and object output use bundled tools and do not require an external linker or SDK.
Install
Keep optional dependencies and installation scripts enabled so npm can install the native command for your platform. For development from a source checkout, see the repository.
Create a program
Create hello.ts:
This program reads the first command-line argument, or uses "world" when no argument is provided.
Compile and run
Use scriptc run to compile and execute the program:
To pass arguments, build an executable and invoke it directly:
This program compiles statically, so the executable does not include a JavaScript engine. The shell examples use POSIX syntax; on Windows, build hello.exe and invoke it with .\hello.exe.
Check compilation support
scriptc coverage analyzes a program without creating an executable:
For programs that need dynamic execution or contain unsupported operations, the report lists the affected sites and diagnostic codes. See Coverage Reports.
Use an npm dependency
Create cli.ts:
Install the package and enable the embedded engine with --dynamic:
The package's JavaScript is embedded at build time. The executable does not read node_modules at runtime. See npm Dependencies for package resolution, type declarations, and runtime behavior.
Next steps
- CLI Reference: commands and options, including output formats and sanitizers.
- Native Program Objects: use program objects in external builds.
- Platform Support: supported hosts and cross-compilation.
- Limitations: compilation restrictions and runtime differences.
