KScript docs
EN

Programs: kscript compile

Targets

A target is the kind of computer a program runs on. kscript compile builds for these:

Target For What you get
mac-arm64 Macs with Apple Silicon hello, or Name.app for a desktop app
mac-x64 Intel Macs the same
linux-x64 Linux on x64 hello, or Name plus Name.desktop and Name.png for a desktop app
linux-arm64 Linux on ARM, such as a Raspberry Pi 4 or 5 the same
win-x64 Windows, on x64 and on ARM through emulation hello.exe, or Name.exe for a desktop app

Without --target, the program is built for the computer you're on. --target takes one or more targets, separated by commas, or all. mac, linux and windows mean mac-arm64, linux-x64 and win-x64. Each target gets its own folder under dist/ (or --out):

CommandWhat it does
kscript compile --target allEvery platform at once.
kscript compile --target mac-arm64,win-x64Some of them.

Runtimes

A program is built from a runtime: the single-file build of kscript for the target platform, published with each release as kscript-runtime-<platform>. kscript compile downloads it once from the release that matches your kscript --version, keeps it in ~/.kscript/runtimes (%LOCALAPPDATA%\kscript\runtimes on Windows), and reuses it after that, so only the first build for each platform needs the network. To work offline, or with your own build, pass --runtime with a runtime binary or archive (kscript-runtime-win-x64.zip) for the one target you're building.

A kscript built from the repository with dotnet build can only build programs with --runtime.

Edit this page on GitHub