Manuscript Documentation
v2026.12.0

Build and share a program#

Use ms run while changing a program, then ms build to produce an executable you can run or share. The recipient needs the matching operating system and architecture, but does not need ms installed.

Check and run your project#

Start from a fresh project so you can try the complete workflow:

sh
ms init my-app
cd my-app
ms check ms.toml
ms run ms.toml --build-type Debug -- first second

The check and run report:

text
types  passed
fmt    passed
lint   passed
Arguments: 2

check catches type errors, unformatted source and lint findings without running the application (--only types runs just the type check). run builds and starts it; arguments after -- go to your program. Debug keeps the edit/run cycle quick.

To rebuild after each saved change, use ms run ms.toml --watch -- first second. To see diagnostics while you type, set up your editor .

Build the executable#

sh
ms build ms.toml -o my-app
./my-app first second
text
Built my-app
Arguments: 2

On Windows, name the output my-app.exe and run .\my-app.exe first second. ms build defaults to optimized Release, while ms run and ms test default to Debug, which optimizes lightly and builds faster. Choose a build level for unoptimized debugging or a smaller executable.

Share the executable only with the platform you built it on. On Linux, the default target uses glibc 2.28 or newer. Use ms build ms.toml --static -o my-app for a self-contained musl executable. Files your program opens by path remain external: distribute them with the program, or embed assets in the executable.

The adjacent my-app.ms-build.json holds the compiler version, build level and backend (llvm); it is not needed to run the executable. Keep the source and debug artifacts if you want to investigate a profile or debug source lines .

Check a change before sharing it#

sh
ms check --test ms.toml
ms map ms.toml --format html -o code-map.html

For the generated project, ms check --test reports:

text
types  passed
fmt    passed
lint   passed
test   passed

check --test checks types, formatting, lint and tests. Fix any failed step before you build the version you intend to share. It never rewrites files. The second command succeeds silently and writes an offline HTML map: open code-map.html to follow source, checked types and calls during review. See the code-map workflow for change overlays.

The same compiler includes the standard library, formatter, linter, language server and analysis tools. Source-only commands such as check, fmt and map need no native linker. For a repeatable team setup, use the same ms version and keep ms.toml with your source.

Build tools and local setup#

ms ships with its own linker (lld), Cranelift library, LLVM library, and static runtime archives installed beside it under lib/ms/. Debug builds emit through Cranelift; Release and MinSizeRel builds optimize and emit through LLVM in-process, with no external opt or llc required.

ToolOverrideShipped location
LinkerMS_LLD: path to a compatible lld executablelib/ms/bin/lld (lld.exe on Windows)
Cranelift libraryMS_CRANELIFT: path to a Cranelift library (off forces LLVM for Debug)lib/ms/lib/ (lib/ms/bin/ on Windows)
LLVM libraryMS_LLVM: path to a compatible shared LLVM librarylib/ms/lib/ (lib/ms/bin/ on Windows)
Runtime & startupMS_RUNTIME, MS_FILES: custom archive list and startup directorylib/ms/runtime/

See install layout and build tools . Compiling ms itself has separate source-build prerequisites .

Rebuild after changes#

ms build, run, test, bench, and ms run --profile compile the whole program fresh on each run using the installed tools and static runtime archives beside ms. See install layout and build tools for layout details and package cache locations.

For the compiler’s internal stages, see the contributor compilation pipeline .