get-started
Install
Install the grain CLI on macOS or Linux, verify dependencies, and prepare for your first VM.
Get the grain binary on your machine and confirm QEMU (or your chosen hypervisor) is ready. When you are done you should be able to run grain version and grain doctor.
Supported platforms
| Host | Architectures | Notes |
|---|---|---|
| macOS | arm64 (Apple Silicon), amd64 (Intel) | Apple Silicon recommended; QEMU + HVF |
| Linux | amd64, arm64 | QEMU; KVM strongly recommended |
grain runs Linux microVMs with hardware virtualization (HVF on macOS, KVM on Linux when available). That is ordinary virtualization on a supported host — not nested virtualization. Nested virt only matters if the machine running grain is already a VM and the outer layer must expose hardware virt to that guest.
Windows (native): not supported as a grain host. From Windows, drive a remote grain daemon on macOS or Linux via the HTTP API or SDKs.
WSL / WSL2: the environment reports as Linux, so the install script accepts it the same way as other Linux hosts. You still need hardware virtualization available to that environment (same requirement as bare-metal Linux). Running grain inside a VM without virt exposed is the nested case above — not a special WSL-only rule.
The install script only accepts darwin and linux (uname) and exits with unsupported OS otherwise.
What you need
- A supported host (table above)
- Network access once (download CLI and base image)
- QEMU for real VMs (default backend)
Package managers (Homebrew formula, apt/rpm, etc.) are planned but not shipped yet — track progress on GitHub issues/releases. Today you install via the script, a GitHub Release binary, or Go.
Option A — Install script (recommended)
curl -fsSL https://raw.githubusercontent.com/cxdy/grain/main/scripts/install.sh | bash
# Optional: also install Grain Desktop (GUI) when a release asset exists,
# or build from source if you run the script inside a checkout with Wails.
curl -fsSL https://raw.githubusercontent.com/cxdy/grain/main/scripts/install.sh | bash -s -- --desktopThe script:
- Detects OS and architecture
- Downloads the latest release binary of
grain - Installs the guest agent binary under
~/.grain/agent/when available - Falls back to
go installif no release asset exists - With
--desktop: prefers a GitHub Release Desktop asset; otherwise may build viajust desktop-buildin a checkout
Default install locations: /usr/local/bin if writable, otherwise ~/.local/bin. Override with GRAIN_INSTALL_DIR.
After install, the script asks whether to enable MCP by default (mcp.enabled in ~/.grain/config.yaml). Non-interactive installs skip the prompt; use GRAIN_ENABLE_MCP=1 or 0 to force yes/no. If you skip, you can enable later with grain up --mcp — see MCP server.
Desktop developer builds: Grain Desktop and desktop/README.md in the repo.
Upgrade
grain update # install latest CLI + Desktop if newer than current
grain update --check # report only (exit 1 when an update is available)grain update re-runs the install script with --desktop (CLI and Grain Desktop release assets when available). Desktop install failure is non-fatal if the CLI updates. Occasional upgrade notices on other commands can be turned off with check_updates: false or GRAIN_CHECK_UPDATES=0.
Install QEMU
macOS
brew install qemuLinux (Debian/Ubuntu)
sudo apt-get update
sudo apt-get install -y qemu-system qemu-utilsLinux (Fedora)
sudo dnf install -y qemu-system-x86 qemu-imgOption B — Release binary
- Open GitHub Releases
- Download
grain_<os>_<arch>(for examplegrain_darwin_arm64) chmod +xand move it onto yourPATH- Optionally download
grain-agent-linux-<arch>into~/.grain/agent/
Option C — From source
go install github.com/cxdy/grain/cmd/grain@latestOr from a checkout:
git clone https://github.com/cxdy/grain.git
cd grain
just test && just build && just agent-linux
./bin/grain versionVerify
grain version
grain doctorgrain doctor checks the data directory, SSH key material, QEMU / qemu-img, ISO tools (for cloud-init seeds), and soft-warns if the Linux guest agent binary is missing.
Healthy checks for your platform are enough to continue. Soft warnings (for example missing agent binary before the first golden image) are fine for SSH-only workflows.
Next
- Quick start — starter config + first sandbox in one page
- First sandbox — guided walkthrough + interactive demo