moxzi CLI referencealpha
Every moxzi command and option.
moxzi COMMAND --help prints the same information.
Commands#
| Command | Does |
|---|
build ENTRY | Compile and link a Motoko program |
link INPUT | Link an unlinked module |
deps ENTRY | List the files a build reads |
stable-compatible PREVIOUS NEW | Check an upgrade between two stable signatures (.most files) |
candid-compatible PREVIOUS NEW | Check that a new Candid interface can replace an old one for existing callers |
agent-bindings DID | Generate a typed Motoko client for a canister, for ic-agent |
verify | Check an on-chain build's record |
publish WASM | Publish a wasm to an ICRC-118 registry |
deprecate | Mark a published version as deprecated |
host new PLATFORM DIR | Create an actor platform project. Also host list, host examples, host principal |
kernel add PACKAGE | Opt your application into an installed package's native kernel |
kernel build CRATE | Build a Rust crate into a native kernel (a .kernel.toml file) |
kernel verify TARGET | Rebuild a kernel from its source and compare it with its pins |
kernel sdk DIR | Write the moxzi-kernel SDK, for cargo generate-lockfile and your editor |
info | Show the compiler and linker in use, with their hashes |
cache path, cache clear | Show or empty the compiled-compiler cache |
Options for every command#
| Option | Effect |
|---|
--compiler WASM | Use this compiler instead of the one found automatically |
--timings | Print how long each phase took |
--pem FILE | Sign Internet Computer calls with this key (Ed25519, secp256k1 or P-256 PEM) |
--identity-dfx NAME, --identity-icp NAME | Sign with this dfx or icp identity's PEM file |
build#
| Option | Effect |
|---|
-o, --out WASM | Output file. Default: the entry name with .wasm |
--no-idl | Don't write the .did file |
--gzip | Also write WASM.gz |
--debug | Keep debug { } blocks |
--no-link | Write an unlinked module |
--linker WASM | Use this linker |
--package NAME PATH | Map mo:NAME to PATH. Repeatable |
--root DIR | The project directory, seen by the compiler as /src |
-v, --verbose | Print the compiler's debug output |
-A, -W, -E CODES | Allow, enable, or make an error of warning codes. Comma-separated; repeatable |
--implicit-derivation-depth N | Maximum depth of implicit argument derivation. Default 100 |
| Option | Effect |
|---|
--stable-types | Also write the stable signature, as a .most file with the same name as the wasm |
--enhanced-migration DIR | Use the migration modules in DIR |
--stable-baseline MOST | Check the migration chain against the deployed signature |
--enhanced-orthogonal-persistence | Allow upgrading a canister that still uses classical persistence. The migration can't be undone. Without this option, such an upgrade fails and the canister keeps running its old code |
--public-metadata NAME | Make a metadata section public. Repeatable. Replaces the default (candid:service, candid:args) |
--omit-metadata NAME | Leave a metadata section out. Repeatable |
Metadata names: candid:service, candid:args, motoko:stable-types, motoko:compiler.
Runtime options#
| Option | Effect |
|---|
--compact-rts | Link a runtime system with a smaller heap, for moxzid and moxzi-web |
--ephemeral | Skip per-message rollback snapshots: faster, but a trap doesn't roll back and state isn't kept across restarts |
--actor-max-pages N | Cap the memory of actors created from actor classes, in 64 KiB pages |
--top-max-pages N | Cap the top-level actor's memory, in 64 KiB pages |
--actor-stack-kib KIB | Stack size for compiled actors. Default 4096. Must be a multiple of 64 |
--stable-regions, --max-stable-pages N, --stabilization-instruction-limit N, --measure-rts-stack | As in moc |
--no-index-fast-path | Turn off the checked array-index optimisation |
--candid-fast-path | Skip decoding a Candid type table that matches the one this compiler emits |
--wasm-tail-call | Emit tail calls for await* chains |
| Option | Effect |
|---|
--stack-budget N | How often the compiler pauses. Higher is faster for large projects. Doesn't change the output |
--force-gc | Collect garbage in the compiler after every step. Doesn't change the output |
--progress N | Print progress every N steps |
--status-secs S | Also print the current compiler phase, at most every S seconds |
--max-steps N | Give up after N steps. Default 5,000,000 |
Native kernels#
| Option | Effect |
|---|
--accept-kernel PACKAGE=sha256:HEX | Accept a third-party native kernel, by the exact bytes your [kernels] pins. Repeatable. Recorded for your user, so later builds of the same bytes don't ask; a new version asks again |
A native kernel is compiled code that runs inside your canister and shares its memory: it can read and write anything in the canister's heap, and its pin guarantees which bytes run, not that they're correct or benign. The first build that links a kernel moxzi doesn't build and pin itself shows its package, sha256, source and commit, then stops until you accept it. In a terminal, type yes; in CI and scripts, pass --accept-kernel. --yes doesn't accept kernels. Set MOXZI_KERNEL_ACKS to keep the acceptances in another file. See Native kernels.
On-chain builds#
| Option | Effect |
|---|
--remote URL | Build on a compiler canister, through this IC gateway |
--canister ID | The compiler canister. Required with --remote |
--resume-job ID | Continue an existing job instead of starting a new one |
--yes | Don't ask before paying. Doesn't accept third-party kernels |
--link-locally | With native kernels: if the compiler canister can't link the build, link it on this machine. The result then has no linked-hash attestation from the canister |
Experimental#
| Option | Effect |
|---|
--experimental-local-actors N | Enable actor*, with N slots |
--experimental-local-actor-persistence | Ignored, with a warning. actor* instances are kept across upgrades by default; declare one transient actor* to opt out |
--local-continuations N | Pending continuation slots for actor* |
--experimental-private-gc, --private-gc-bounce-every N | Collect garbage inside a message at await* points |
link#
| Option | Effect |
|---|
-o, --out WASM | Output file. Default: INPUT.linked.wasm |
--linker WASM | Use this linker |
--compact-rts | Link the compact runtime system |
-v, --verbose | Print the linker's debug output |
deps#
| Option | Effect |
|---|
--package NAME PATH, --root DIR | As for build |
--paths-only | Print only the compiler's paths, one per line |
verify#
| Option | Effect |
|---|
--remote URL, --canister ID | The compiler canister. Required |
--job N | The build to check. Default: the most recent |
--list | List recent builds instead |
--entry FILE | Compare recorded source hashes with your files |
--artifact WASM | Compare a wasm's hash with the recorded artifact |
--expect-module WASM | Check that the canister runs this module |
publish#
| Option | Effect |
|---|
--remote URL, --registry ID | The registry. Required |
--namespace NAME, --version X.Y.Z | Where to publish. Required |
--canister ID, --job N | Attach this build record |
--previous X.Y.Z | The version this one upgrades |
--repo URL, --commit HASH | Source location. Read from git when possible |
--description TEXT | What this version is |
--create, --name NAME | Create the namespace first |
--allow-offchain | Allow publishing a --compact-rts build |
--dry-run | Show what would be sent, and send nothing |
deprecate#
| Option | Effect |
|---|
--remote URL, --registry ID, --namespace NAME, --version X.Y.Z | The version. Required |
--reason TEXT | Why |
--undo | Remove the deprecation |
agent-bindings#
| Option | Effect |
|---|
--name NAME | Module name. Default: the file name |
-o, --out FILE | Output file. Default: standard output |
--agent-import PATH | Import path for the agent. Default mo:ic-agent |
host new#
| Option | Effect |
|---|
--example NAME | counter (default), ledger or saga |
kernel add#
moxzi kernel add PACKAGE opts your application into the native kernel of a package it already depends on. It shows the kernel's package, version, sha256, size, functions, and declared source and commit, checks that the kernel file's bytes match its own sha256, then writes the pin into your mops.toml:
[kernels]
moxzi-hash = "sha256:..."
Only that line changes. If there is no [kernels] table, moxzi appends one, and the rest of the file keeps its formatting. Running it again after the package changes updates the pin. A package without a kernel is refused.
For a third-party kernel (one moxzi doesn't build and pin itself), add also prints what a kernel can do. Adding the pin is not the same as accepting the kernel: the first build that links it still asks you to accept those bytes.
| Option | Effect |
|---|
--root DIR | The application directory. Default: the current directory |
kernel build#
moxzi kernel build CRATE compiles a Rust crate into a native kernel and writes a .kernel.toml file: the wasm in base64, its sha256 and its size. The same crate gives the same bytes on every machine, so anyone can rebuild a kernel and check its pin. Writing a kernel walks through a complete one.
| Option | Effect |
|---|
-o, --out FILE | Output file. Default: NAME.kernel.toml in the current directory, where NAME is the crate's package name without a -kernel suffix |
You need rustup with the toolchain nightly-2026-07-25 and its rust-src component. Install them with rustup toolchain install nightly-2026-07-25 --profile minimal --component rust-src. moxzi checks the compiler and its linker by commit. If either is missing or different, the build stops and prints the rustup command that fixes it.
The crate must follow these rules:
| Rule | Why |
|---|
crate-type = ["staticlib"], #![no_std] | A kernel is linked into the canister as a position-independent wasm64 library |
A Cargo.lock next to Cargo.toml | The build uses --locked, so the lock decides every dependency version. Commit it |
The SDK as moxzi-kernel = { path = "../moxzi-kernel" } (or "../../moxzi-kernel", and so on) | moxzi builds against the SDK it carries, at the same path on every machine. What is at ../moxzi-kernel on your disk is not used |
| Other path dependencies inside the crate directory | Only the crate directory is copied into the build |
Exports in src/lib.rs, as #[no_mangle] pub extern "C" fn or pub unsafe extern "C" fn | Every such function in that file is exported |
Build configuration in [package.metadata.moxzi-kernel] cfg = ['name="value"'] | The only way to pass --cfg values to dependencies |
Every build runs in /tmp/moxzi-kernel-build, which is deleted first. One build runs at a time. RUSTFLAGS, RUSTC_WRAPPER and the other cargo and rustc settings in your environment are ignored, and each one is named in the output. Cargo configuration files still apply, and each one found is named too.
Write the SDK next to a new crate and generate its lock:
moxzi kernel sdk moxzi-kernel
cargo +nightly-2026-07-25 generate-lockfile --manifest-path reverse-kernel/Cargo.toml
moxzi-kernel: the moxzi-kernel SDK (sources sha256:e055dee34c8e2dd6662fe25e7cb7b7113b648a127122d25a0197d26cc1da3529)
Locking 1 package to latest compatible version
Build the kernel:
moxzi kernel build reverse-kernel
reverse.kernel.toml: 5633 B, sha256:a0c5237421a2b950e2085d580f53f57dc587db119e4726ecc6f41c5bc40b8e72
kernel verify#
moxzi kernel verify TARGET rebuilds a kernel and compares its bytes with every pin it must equal. It prints MATCH or DIFF for each pin and exits with a non-zero status unless all match. TARGET is one of:
| Target | Compared with |
|---|
A kernel package (a directory whose mops.toml has [kernel]) | The sha256 of its [kernel] file |
A .kernel.toml file | Its sha256. If a package names the file, as for a package |
An application (a directory whose mops.toml has [kernels]) | For each pinned package: the package's file and your [kernels] pin |
| Option | Effect |
|---|
--crate DIR | Rebuild from this crate instead of the package's declared source |
--git | Clone the declared source even when a local checkout of it is found |
Without --crate, moxzi rebuilds from the package's [kernel] source and commit:
source | Rebuilt from |
|---|
https://HOST/OWNER/REPO/tree/REV/PATH | The directory PATH of the repository, at commit, or at REV when there is no commit |
| Any other git URL | The repository's root directory, at commit |
When the package sits in a git checkout of that repository, moxzi uses the checkout, including uncommitted changes, and says so. Otherwise it fetches the commit into a temporary directory. Declare commit in a published package. A branch name moves, and moxzi prints a note when it checks one.
moxzi kernel verify reverse.kernel.toml --crate reverse-kernel
MATCH reverse.kernel.toml: sha256:a0c5237421a2b950e2085d580f53f57dc587db119e4726ecc6f41c5bc40b8e72
MATCH reverse: rebuilt sha256:a0c5237421a2b950e2085d580f53f57dc587db119e4726ecc6f41c5bc40b8e72 (5633 B)
kernel verify: every pin MATCHES the rebuilt bytes
kernel sdk#
moxzi kernel sdk DIR writes the moxzi-kernel SDK that this moxzi builds with. Cargo needs it on disk to generate Cargo.lock, and your editor needs it to check the crate.
| Option | Effect |
|---|
--force | Overwrite DIR when it holds something other than this SDK |
Environment variables#
| Variable | Meaning |
|---|
MOXZI_COMPILER, MOXZI_LINKER | Compiler and linker to use. The options override them |
MOXZI_MOPS | Path to mops, if it isn't on your PATH |
MOXZI_IDENTITY | Where moxzi keeps its own signing key |
MOXZI_ADAPTERS | Where host new finds adapters, if not next to moxzi |
MOXZI_KERNEL_WORKDIR | Where kernel build builds, instead of /tmp/moxzi-kernel-build. Kernels built anywhere else don't match their pins |
Removed options#
--legacy-actors, --no-eop and --trap-on-call-error are no longer supported and print an error. --default-persistent-actors is ignored with a warning: every actor is persistent.