RunMat Command Line Interface (CLI)
The RunMat CLI is a fast and easy way to run .m files locally, open an interactive REPL, inspect runtime behavior, and work with remote project filesystems.
Install RunMat first if the runmat command is not already on your PATH. See Installation for install options.
To check the version of RunMat, run:
runmat --versionREPL
Run runmat with no command to open the interactive REPL.
runmatYou can also start it explicitly:
runmat repl
runmat repl --verboseThe REPL keeps one session alive, so variables remain available between prompts.
A = magic(3)
sum(A)REPL commands:
| Command | Use |
|---|---|
help | Show REPL help. |
exit, quit | Leave the REPL. |
.info | Show runtime information. |
.stats | Show execution statistics. |
.gc, .gc-info | Show garbage collector statistics. |
.gc-collect | Force a major collection. |
.reset-stats | Reset execution statistics. |
The REPL also accepts piped input:
printf "1 + 1\n" | runmat replRun
Run a local .m file by passing the path directly:
runmat analysis.mThe explicit form is:
runmat run analysis.mRunMat also resolves configured project entrypoints. If a project has runmat.toml with an entrypoint named main, this works:
runmat run mainSee Projects for project layout and entrypoint configuration.
For relative source paths, RunMat can infer a missing .m extension:
runmat run src/mainExecution uses the same session pipeline as other hosts: parse, lower, compile, run, emit streams, update workspace, and report structured diagnostics.
Pass Runtime Options
Global options apply to the REPL, local scripts, and most commands.
runmat --no-jit analysis.m
runmat --jit-opt-level aggressive analysis.m
runmat --gc-preset low-latency analysis.m
runmat --plot-headless analysis.mCommon options:
| Option | Use |
|---|---|
--config PATH | Load a specific runmat.toml or runmat.json. |
--debug | Enable debug logging. |
--log-level LEVEL | Set log verbosity. |
--verbose | Print more execution detail. |
--snapshot PATH | Preload a runtime snapshot. |
--no-jit | Use the interpreter only. |
--jit-threshold N | Set the execution count before JIT tiering. |
--jit-opt-level LEVEL | Set JIT optimization policy. |
--gc-preset PRESET | Select a GC tuning preset. |
--gc-young-size MB | Override young generation size. |
--gc-threads N | Override GC worker count. |
--gc-stats | Collect GC statistics. |
--plot-mode MODE | Select plotting mode (auto |
--plot-headless | Force headless plotting. |
--plot-backend BACKEND | Select plotting backend (auto |
Configuration is resolved from built-in defaults, project files, environment variables, and CLI flags. CLI flags have the highest precedence. See Configuration Reference.
Emit Bytecode
Use bytecode output when debugging the compiler pipeline or checking what a script lowers into before execution.
runmat --emit-bytecode analysis.mWrite the disassembly to a file:
runmat --emit-bytecode bytecode.txt analysis.mWhen bytecode emission is enabled, the script is compiled and disassembled instead of being executed.
Capture Artifacts
For batch jobs, CI, and notebook-style hosts, the CLI can write a run manifest and exported figure images.
runmat \
--artifacts-dir .runmat-artifacts \
--capture-figures auto \
--figure-size 1280x720 \
analysis.mThe manifest records execution metadata, stream sizes, touched figure handles, figure export paths, JIT usage, and any error identifier. Figure capture writes PNG files under the artifact directory when figures are touched or when capture is forced on.
Artifact options:
| Option | Use |
|---|---|
--artifacts-dir PATH | Directory for run artifacts. |
--artifacts-manifest PATH | Exact JSON manifest path. |
--capture-figures MODE | Figure export policy (off |
--figure-size WIDTHxHEIGHT | Figure export dimensions. |
--max-figures N | Maximum number of touched figures to export. |
Inspect Runtime
Use these commands when filing issues, tuning performance, or checking what runtime configuration is active.
runmat info
runmat version --detailed
runmat gc stats
runmat accel-info| Command | Use |
|---|---|
info | Print version, runtime configuration, environment, and GC status. |
version --detailed | Print build details useful for support and bug reports. |
gc stats | Print current GC counters. |
gc minor, gc major | Force a minor or major collection. |
gc config | Print current GC configuration. |
accel-info | Print acceleration provider and telemetry details. |
accel-info --json | Emit acceleration details as JSON. |
Configuration
Generate a starter config:
runmat config generate -o runmat.tomlInspect resolved configuration:
runmat config show --format toml
runmat config show --format jsonValidate and locate config files:
runmat config validate runmat.toml
runmat config pathsconfig generate writes both project and runtime sections, so the generated file can be used as a starting point for named entrypoints and runtime tuning.
Benchmark
Benchmark a script or named entrypoint with repeated execution in one session.
runmat benchmark analysis.m --iterations 25
runmat benchmark main --iterations 25 --jitThe benchmark command performs warmup runs, then reports total iterations, JIT executions, interpreter executions, total time, average time, and throughput.
Snapshots
Snapshots preload runtime assets so startup does less work.
runmat snapshot create -o stdlib.snapshot --compression zstd -O speed
runmat snapshot info stdlib.snapshot
runmat snapshot validate stdlib.snapshot
runmat snapshot presetsLoad a snapshot for a script or REPL:
runmat --snapshot stdlib.snapshot analysis.m
runmat --snapshot stdlib.snapshotRemote Projects
Remote commands connect the CLI to a RunMat server project. They are useful for hosted workspaces, shared project filesystems, and remote data layouts that should be mounted into local execution.
Authenticate first:
runmat login
# or explicitly specify the server URL
runmat login --server https://api.runmat.comFor automation, pass an API token:
runmat login \
--server https://api.runmat.com \
--api-key "$RUNMAT_API_KEY" \
--project <project-id>Alternatively, use environment variables to set the server URL and API token:
| Variable | Use |
|---|---|
RUNMAT_CONFIG | Runtime config path. |
RUNMAT_SERVER_URL | Remote server URL. |
RUNMAT_API_KEY | Remote API token. |
RUNMAT_ORG_ID | Default remote org. |
RUNMAT_PROJECT_ID | Default remote project. |
List and select projects:
runmat org list
runmat project list
runmat project select <project-id>Use the project filesystem:
runmat project fs ls /data
runmat project fs read /data/input.mat --output input.mat
runmat project fs write /data/input.mat ./input.mat
runmat project fs mkdir /data/results --recursive
runmat project fs rm /data/old.matThe top-level fs command is a shorthand for the project filesystem namespace:
runmat fs ls /dataRun a script loaded from the remote filesystem:
runmat remote run /scripts/analysis.m
runmat remote run /scripts/analysis.m --project <project-id>remote run reads the source from the selected remote project, installs the remote filesystem provider for the run, and executes the script locally with the current runtime configuration.
Remote filesystem commands also cover file history, manifest history, snapshots, retention policy, and git-style project sync. Use command help for the full tree:
runmat project fs --help
runmat project retention --help
runmat fs --helpCommand Help
Every command and subcommand has built-in help.
runmat --help
runmat run --help
runmat config --help
runmat project fs --helpUse command help as the source of truth for exact flags in the installed version.