This guide walks you through installing Mako, creating a project, and running your first program. By the end you will have a working development loop.
From a source checkout (requires cargo/rustc and clang):
make install
This places the mako binary in ~/.local/bin/ and runtime headers in
~/.local/share/mako/runtime. Ensure ~/.local/bin is on your PATH.
Verify the installation:
mako version
# mako version mako0.1.0 darwin/arm64
mako version -v
# includes the git commit hash
Mako provides scaffolding for three project shapes:
# Simple application
mako init hello --name hello
# Backend API service (includes HTTP handler scaffold)
mako init mysvc --backend
# Multi-package workspace (lib + app)
mako init myws --workspace
Each creates a directory with mako.toml and a main.mko entry point.
After mako init hello --name hello:
hello/
mako.toml # package manifest (name, version, dependencies)
main.mko # entry point — must contain fn main()
The mako.toml looks like:
name = "hello"
version = "0.1.0"
Open hello/main.mko:
fn main() {
print("hello from mako")
print_int(fib(10))
}
fn fib(n: int) -> int {
if n <= 1 {
return n
}
return fib(n - 1) + fib(n - 2)
}
From inside the hello/ directory:
# Typecheck without compiling (fast feedback)
mako check main.mko
# Compile and run in one step
mako run main.mko
# Build a binary (name comes from mako.toml)
mako build main.mko
# Run the binary directly
./hello
mako run main.mko -- arg1 arg2
Inside the program, use argc(), arg_get(i), or args() to read them.
| Command | Purpose |
|---|---|
mako check file.mko |
Typecheck (incremental, fast) |
mako run file.mko |
Compile and execute |
mako build file.mko |
Produce a binary |
mako build --release file.mko |
Optimized production binary |
mako build -j 8 file.mko |
Parallel compilation |
mako test path/ |
Run tests |
mako fmt file.mko |
Format source code |
mako version |
Print version and platform |
If you have not installed yet, run directly from the compiler source tree:
cargo run --release -- check examples/hello.mko
cargo run --release -- run examples/hello.mko
| Variable | Purpose |
|---|---|
MAKO_RUNTIME |
Override runtime header location |
MAKO_JOBS |
Default parallel job count (same as -j) |