wasmer run CLI

Run a WebAssembly file or Wasmer container.


Run a Wasmer package

All packages published on Wasmer Registry can be run with the wasmer run command.

wasmer run python/python

Some commands, such as cowsay have multiple commands that we can run (eg. cowsay or cowthink)

wasmer run syrusakbary/cowsay --command-name=cowthink Hello world

If in your current dir you have a wasmer.toml file, you can simply run the local package with:

wasmer run .

Wasmer run also allows running from URLs (in case a package is hosted on a different registry).

wasmer run

Run a Wasm file

wasmer run my_program.wasm

Run a Wasm file with a custom compiler

wasmer run my_program.wasm --singlepass

You can also use --cranelift or --llvm instead of --singlepass.

Run a WASI or WASIX Module

You can pass the arguments that will be given to the WASI program:

wasmer run my_wasi_program.wasm -- arg1 arg2 arg3

You can also pass environment variables:

wasmer run my_wasi_program.wasm --env MYVAR=MYVALUE -- arg1 arg2 arg3


This is the help output from the Wasmer CLI for wasmer run --help:

Usage: wasmer run [OPTIONS] <INPUT> [ARGS]...

          The file, URL, or package to run

          Command-line arguments passed to the package

  -v, --verbose...
          More output per occurrence

  -q, --quiet...
          Less output per occurrence

      --wasmer-dir <WASMER_DIR>
          The Wasmer home directory

          [env: WASMER_DIR=/Users/syrusakbary/.wasmer]
          [default: /Users/syrusakbary/.wasmer]

          Use Singlepass compiler

          Use Cranelift compiler

          Use LLVM compiler

          Enable compiler internal verification

          Enable support for the SIMD proposal

          Disable support for the threads proposal

          Deprecated, threads are enabled by default

          Enable support for the reference types proposal

          Enable support for the multi value proposal

          Enable support for the bulk memory proposal

          Enable support for all pre-standard proposals

      --dir <DIR>
          WASI pre-opened directory

      --mapdir <GUEST_DIR:HOST_DIR>
          Map a host directory to a different location for the Wasm module

      --env <KEY=VALUE>
          Pass custom environment variables

          Forward all host env variables to the wcgi task

          [env: FORWARD_HOST_ENV=]

      --use <USE>
          List of other containers this module depends on

      --include-webc <WEBC>
          List of webc packages that are explicitly included for execution Note: these packages will be used instead of those in the registry

      --map-command <MAPCMD>
          List of injected atoms

          Enable networking with the host network.

          Allows WASI modules to open TCP and UDP connections, create sockets, ...

          Disables the TTY bridge

          Enables asynchronous threading

          Allow instances to send http requests.

          Access to domains is granted by default.

          Require WASI modules to only import 1 version of WASI

      --registry <REGISTRY>
          The registry to use

          [env: WASMER_REGISTRY=]

  -a, --addr <ADDR>
          The address to serve on

          [env: ADDR=]

      --stack-size <STACK_SIZE>
          Set the default stack size (default is 1048576)

  -e, --entrypoint <ENTRYPOINT>
          The function or command to invoke

          Generate a coredump at this path if a WebAssembly trap occurs

  -h, --help
          Print help (see a summary with '-h')