The ztk program
This page has each form of the command line of ztk: the flags of a run, and ztk bundle. It comes from the help texts of the program (ztk --help and ztk bundle --help), through tools/cli-doc.sh.
ztk script.tcl runs a Tk script in a window. The flags of the interpreter, such as --allow, --root, and --tcl, are those of ztcl: see the ztcl program.
A run and its flags
usage: ztk [flags] script.tcl [arguments]
ztk [flags] app.wasm a WebAssembly app with the interface tk
ztk [flags] https://HOST/app.wasm the same from a URL, in a sandbox with no capability
ztk bundle -o Name.app [options] main.tcl [files] (ztk bundle for its options)
ztk --android [--device SERIAL] main.tcl [files] run as an app on an Android emulator or device, with its log here
ztk --ios [--device NAME] main.tcl [files] on macOS: run as an app in the iOS Simulator, with its output here
ztk [flags] code claude [options] [-- claude-arg ...] (Claude Code in the harness of ztcl)
--headless use the headless backend and the CPU renderer
--mcp run the script headless, then serve the MCP tools of ztk::debug on stdin and stdout
--cpu use the CPU renderer on Wayland
--exit-after-frames N exit with status 0 after N frames
--screenshot FILE.png with --headless: write the last frame at the exit
--time MS with --headless: draw the first frame, then move the clock to MS
--scale N with --headless: the scale of the window
--direct needs --direct-unsafe-test-device (the VT is not fully owned yet)
--direct-unsafe-test-device with --direct: run on a device that is free to lose its console
--fb DEVICE with --direct: the framebuffer (default /dev/fb0)
--rotate 0|90|180|270 with --direct: the rotation of the panel
--touch-debounce MS with --direct: the debounce time of a touch panel
--tty DEVICE with --direct: the VT, for example /dev/tty1 (default: the terminal of the input)
--output NAME with --direct: auto, vulkan, or framebuffer (vulkan is not available yet)
--dark the dark color scheme
--windowingsystem NAME the result of tk windowingsystem: x11, win32, aqua, or ztk
--allow a,b more capabilities of ztcl, with the names of the ztcl runner (file, channels, and clock are on)
--root DIR the folder of the file commands (default: the paths of the host)
--tcl 8.6|9.1 the Tcl and Tk release that the script follows (default 9.1, or ZTCL_TCL)
--device SERIAL with --android: the device (default: ANDROID_SERIAL, or the one device of adb devices)
--device NAME with --ios: the simulator, a name or a UDID (default: ZTK_IOS_SIMULATOR, a booted iPhone, or the newest iPhone)
version, --version print the version, the Tcl release, the target, the build mode, and the commit
--help, -h print this text
ztk bundle
ztk bundle makes an app for Linux, macOS, Windows, Android, or iOS from a script and its files. An Android app has the ztk runtime of zig build android (Android), and an iOS app has the ztk program of zig build runtimes (iOS).
usage: ztk bundle -o Name.app [--target T] [options] main.tcl [file or folder ...]
ztk bundle -o app [--target T] [--runner FILE] [--allow CAPS] main.tcl [file or folder ...]
-o FILE with .app: a macOS app folder (with --target, x86_64-macos or
aarch64-macos), or an iOS app folder (--target aarch64-ios,
aarch64-ios-simulator, or x86_64-ios-simulator); without .app:
one program file with the app in it
--target T the target of one program file: x86_64-linux, aarch64-linux,
x86_64-macos, aarch64-macos, x86_64-windows, aarch64-windows
(default: this computer)
--name NAME the name of the app (default: the name of -o)
--id ID the bundle identifier (default: org.ztk.NAME)
--version V the version (default: 1.0)
--icon FILE.png the icon, square, 1024 pixels or less (a Windows program: a
.ico, or a .png of 256 pixels or less; an iOS app: 1024
pixels, put on white, compiled with actool of Xcode; an
Android app: a legacy icon and an adaptive one)
--allow CAPS the capabilities of the app, as for ztk --allow
--tcl 8.6|9.1 the Tcl and Tk release of the app (default: 9.1)
--menu-bar-only no Dock icon (LSUIElement), for an app with a tray
--runner FILE the ztk program to copy (default: this program, or for one
program file of another target lib/ztk/runtime/T/ next to it)
--desktop with one program file of a Linux target: also write NAME.desktop
and NAME.png (from --icon, 256 pixels) next to it
--no-sign leave the app folder unsigned (default: an ad hoc signature
with the JIT entitlement, from codesign on macOS)
--console a Windows program with a console window (default: the GUI
subsystem, with the console of the terminal that starts it)
--sign-cert FILE sign a Windows program (Authenticode) or an Android app (APK
v2): a PEM file with the certificate of the signer first,
then the rest of its chain
--sign-key FILE the private key of that certificate: a PEM file with no
password, with a P-256, P-384, or RSA key
-o Name.ipa an iOS app for a device (--target aarch64-ios), signed with
--ios-identity and --ios-profile
--ios-plist FILE keys to add to the Info.plist of an iOS app, such as the
usage text of a permission (a plist in XML)
--ios-privacy FILE the privacy manifest of an iOS app (default: one that
declares the file timestamps of the app container)
--ios-identity ID the code signing identity of an iOS app for a device, as
codesign names it (default: ZTK_IOS_SIGN_IDENTITY)
--ios-profile FILE the provisioning profile of that app (default: ZTK_IOS_PROFILE)
-o Name.apk an Android app, with --target aarch64-linux-android or
x86_64-linux-android: the ztk runtime libztk.so of
lib/ztk/runtime/TARGET/ (or --runner) and the scripts;
signed with --sign-cert and --sign-key, or with the
debug key of this computer (made at the first use)
--version-code N the version code of an Android app (default: 1)