Skip to content

Guide · Open source

How to use Wasmer: install the CLI and run sandboxes

Updated · written with AI from the project's own documentation and checked against our catalogue data

Wasmer runs programs inside sandboxes, isolated environments where you decide which files, network access and environment variables a program can use. This guide shows how to install the Wasmer CLI, run packaged software such as Python and Bash, and start using the JavaScript SDK to run code from your own app. By the end you will be able to run a sandboxed command and know where to look next.

Wasmerwasmerio/wasmer · ★ 21.2k · MIT

Quick start

  1. 1Install the CLI. Run the curl install command on macOS or Linux, or use Homebrew with brew install wasmer. On Windows, use the PowerShell command from the guide.
  2. 2Run a packaged program. Run wasmer run python/python with -- before the program arguments to execute Python inside a sandbox.
  3. 3Grant access only when needed. Use --volume to give the program a directory and --net to enable host networking.
  4. 4Try it in the browser. Open wasmer.sh if you want to test a sandbox without installing anything.
  5. 5Install the JavaScript SDK. Run npm install @wasmer/sdk in a project using Node.js 20 or newer.
  6. 6Run code from your app. Create a sandbox with the package you need, run a command and print the output.

Install the Wasmer CLI on macOS, Linux or Windows

On macOS or Linux, install the CLI from a shell with the curl command below. You can also install it with Homebrew. On Windows, use PowerShell with the command listed below.

  • macOS or Linux: curl script (see code block)
  • Homebrew (macOS / Linux): brew install wasmer
  • Windows: run the PowerShell command in the code block
  • More options are in the installation guide at docs.wasmer.io/install
curl https://get.wasmer.io -sSfL | sh

Run Python in a sandbox

The CLI runs packages from the Wasmer registry. This command runs Python inside a sandbox and prints a message. Wasmer downloads the package the first time and caches it for later runs.

Use -- to separate Wasmer options from the arguments passed to your program.

  • Try Bash with wasmer/bash
  • Try Cowsay with syrusakbary/cowsay
  • Browse packages at wasmer.io/explore
wasmer run python/python -- -c "print('Hello from Wasmer')"

Control what the sandbox can access

Wasmer is secure by default, so you grant access explicitly. To work with local files, give the program a directory with --volume. To allow network access, add --net. Only enable these when your program needs them.

Programs must run inside the sandbox, so host files and networking are available only through the flags you set.

  • --volume: grants access to a directory
  • --net: enables host networking

Try Wasmer in your browser

If you do not want to install anything, open wasmer.sh to try a sandbox in your browser. Execution happens in the browser itself.

Embed sandboxes in your app with the Wasmer SDK

The Wasmer SDK lets you create a sandbox, choose its tools and run code from inside your application. The JavaScript SDK requires Node.js 20 or newer and is installed with npm. Python, Rust and Swift SDKs are also available, each with its own guide.

The SDK is currently alpha according to the README, so check the language guide for platform support and capabilities before relying on it in production.

  • JavaScript / TypeScript: Node.js 20 or newer
  • Python: wheels for macOS and Linux on Intel and ARM64
  • Swift: macOS 12+ and iOS 27+, Swift 6 or newer
  • Rust: currently a source dependency, crates.io publishing disabled
npm install @wasmer/sdk

Run code from JavaScript with the SDK

Save the example as sandbox.mjs and run it with node. Python executes inside the sandbox, so Python does not need to be installed on the host. The SDK also supports creating processes, files and services; see the JavaScript guide for details.

  • Run with: node sandbox.mjs
  • Full JavaScript guide: github.com/wasmerio/wasmer-sdk/tree/main/js
import { Wasmer } from "@wasmer/sdk/node"; const wasmer = new Wasmer(); const sandbox = await wasmer.sandboxes.create({ packages: ["python/python@=3.13.20"], }); const output = await sandbox .command("python", ["-c", "print('Hello from Wasmer')"]) .run(); console.log(output.text());

What people use it for

  • Running untrusted or third-party code with explicit access controls
  • Trying Python, Bash or FFmpeg without installing them locally
  • Embedding isolated code execution in your own application through the SDK
  • Giving an AI agent a contained place to run code

Frequently asked questions

Is Wasmer free to use?

Wasmer is open source and released under the MIT licence, as stated in the project's README. The MIT licence permits use, and the source does not mention prices or paid plans.

How do I install Wasmer?

On macOS or Linux, run curl https://get.wasmer.io -sSfL | sh, or use brew install wasmer with Homebrew. On Windows, use the PowerShell command iwr https://win.wasmer.io -useb | iex.

What do I need to use the Wasmer JavaScript SDK?

The JavaScript SDK needs Node.js 20 or newer. Install it with npm install @wasmer/sdk.

Is Wasmer a Docker alternative?

Wasmer and Docker both isolate programs, but Wasmer is a WebAssembly runtime and sandbox platform. Comparable projects named in the source include Docker, gVisor, Firecracker and Wasmtime, so compare them against your isolation and packaging needs.

Why does my program not have access to my files or the network?

Wasmer is secure by default and you control file, network and environment access. Grant a directory with --volume and enable host networking with --net when your program needs them.

Is the Wasmer SDK ready for production?

The README says the SDK is currently alpha. Check the language guides for platform support and capabilities before using it in a production project.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Wasmer suits developers who want to run untrusted code with explicit access controls, teams embedding sandboxes through the SDK, and builders of AI agents who need a contained place to run code. It is not a finished end-user app, and if you need a mature, stable SDK today or full native performance and OS-level features, consider other tools such as Docker or Wasmtime.

Install options & downloads