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
-
Install WasmEdge for your operating system, then run this command in your terminal. It prints the runtime version.
wasmedge --version -
Download hello.wasm and open a terminal in its directory. This example is already compiled.
-
Run the program.
wasmedge hello.wasmExpected 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 variable | CLI options for arguments, --dir, and --env |
| Call a function exported by a module | Run a function with --reactor |
| Run an application that requires a plug-in | Use a plug-in with the CLI |
| Compile a module ahead of time and run the result | Compile and run in AOT mode |
| Inspect a module's imports, exports, or sections | Inspect a module with wasmedge parse |
| Check whether a module is valid | Validate a module with wasmedge validate |
| Check whether imports can be resolved | Link a module with wasmedge instantiate |
| Look up another flag or diagnose a runtime error | CLI reference · Troubleshooting guide |