mruby bytecode, rebuilt in Rust
The core VM loads .mrb bytecode. Its Ruby subset includes classes and modules,
exceptions, blocks and closures, control flow, and keyword arguments.
mruby-compatible · Pure Rust · Wasm-first
mruby/edge is a virtual machine built from scratch in Rust for WebAssembly. It runs mruby bytecode in small, portable modules and embeds cleanly in Rust applications.
$ cargo install mrubyedge-cli
$ mrbedge -e 'puts RUBY_ENGINE'
mruby/edge
$ mrbedge app.rb
$ mrbedge app.mrb
Current runtime
The VM focuses on the Ruby features needed to run real programs at the edge, while keeping WebAssembly host integration explicit.
The core VM loads .mrb bytecode. Its Ruby subset includes classes and modules,
exceptions, blocks and closures, control flow, and keyword arguments.
Build for wasm32-wasip1, or target wasm32-unknown-unknown
with --no-wasi. Minimal builds can stay under 400 KiB.
Sidecar .import.rbs and .export.rbs files connect Ruby methods
to WebAssembly functions across the host boundary.
Cargo flags add Regexp, Random, instruction limits, or FNV-backed hashes.
SharedMemory provides direct access to Wasm linear memory.
CLI workflow
mrbedge compiles Ruby source, runs source or precompiled bytecode,
starts a REPL, and generates WebAssembly modules.
The core VM executes bytecode; source compilation is provided by the CLI. For the exact supported Ruby surface, see the compatibility coverage.
# app.rb
def add(a, b)
a + b
end
# app.export.rbs
def add: (Integer, Integer) -> Integer
$ mrbedge wasm app.rb -o app.wasm
[ok] wasm file is generated: app.wasm
On stage
From building a new mruby-family VM for Wasm to deploying Ruby applications across edge platforms with Uzumibi.
RubyKaigi 2024
Why mruby/edge began, how its bytecode VM works, and how Ruby methods become WebAssembly exports—plus the project’s early Component Model ambitions.
RubyKaigi 2026
The evolved VM—OOP, exceptions, closures, keyword arguments, and feature flags— meets Uzumibi, a lightweight framework for portable Ruby edge applications.
Built with mruby/edge
mruby/edge runs beneath products that bring Ruby to different WebAssembly hosts—from spreadsheet formulas to Cloudflare Workers.
Write Ruby as a Google Sheets custom function. sheetruby embeds the VM in Google Apps Script and evaluates formulas through WebAssembly.
Explore sheetruby ↗Build and deploy Ruby applications for Cloudflare Workers with an mruby/edge-powered WebAssembly runtime.
Explore Uzumibi ↗Dive deeper
Source, API references, published crates, and a browser playground.