Overview
MXC for Ruby runs a command in an operating system sandbox and hands you back its output. You decide which paths the command can read and write, whether it gets the network, which hosts it may reach, and how long it may run.
result = MXC.run("python3 build.py", readable: "app/skills", writable: "tmp/out", timeout: 30)
result.stdout
result.success?
Use it when your application runs code it did not write: scripts generated by a language model, skills uploaded by users, or build steps from a third party.
How it works
The gem is an unofficial Ruby binding to Microsoft’s MXC, an MIT-licensed sandbox library written in Rust. MXC drives the sandbox your operating system already has:
| Platform | Backend | Status in 0.1.0 |
|---|---|---|
| Linux | Bubblewrap | Supported and tested |
| macOS | Seatbelt (sandbox-exec) |
Supported and tested |
| Windows | ProcessContainer (BaseContainer or AppContainer) | Supported and tested, without host allow-lists |
The gem compiles MXC into a native extension, so you install one gem and no separate service. Precompiled gems cover Linux (glibc and musl, x86_64 and ARM64), macOS (Intel and Apple Silicon), and Windows (x64 and ARM64).
This project is not affiliated with or endorsed by Microsoft.
Where to go next
- Getting Started installs the gem and runs your first sandboxed command.
- Running Commands covers results, streaming, and interactive processes.
- Policies explains filesystem, network, environment, and timeout settings.
- Checking the Host shows how to detect what the machine supports and what to do when it does not.
- Running in Docker configures a container so it can start sandboxes.