跳至主要内容

Run a Wasm file with the CLI

If you already have a WASI command-line application, open a terminal in the directory containing the file and run wasmedge app.wasm, replacing app.wasm with your filename. To try it with a working example, follow the steps below.

Run your first program​

  1. Install WasmEdge for your operating system, then run this command in your terminal. It prints the runtime version.

    wasmedge --version
  2. Download hello.wasm and open a terminal in its directory. This example is already compiled.

  3. Run the program.

    wasmedge hello.wasm

    Expected output:

    Hello WasmEdge!

Choose your next CLI task​

I want to…Where to go
Pass arguments, make a directory available to Wasm, or set an environment variableCLI options for arguments, --dir, and --env
Call a function exported by a moduleRun a function with --reactor
Run an application that requires a plug-inUse a plug-in with the CLI
Compile a module ahead of time and run the resultCompile and run in AOT mode
Inspect a module's imports, exports, or sectionsInspect a module with wasmedge parse
Check whether a module is validValidate a module with wasmedge validate
Check whether imports can be resolvedLink a module with wasmedge instantiate
Look up another flag or diagnose a runtime errorCLI reference · Troubleshooting guide