Install opencode on macOS, Linux, or Windows

getting started

// what it does

The curl script auto-detects your OS and drops the opencode binary in a local bin directory (override with OPENCODE_INSTALL_DIR). npm i -g opencode-ai works anywhere Node runs, including Windows, and brew install anomalyco/tap/opencode tracks releases faster than the plain homebrew-core opencode formula. All paths install the same binary and self-update afterward.

// shell

$ curl -fsSL https://opencode.ai/install | bash
$ npm i -g opencode-ai@latest
$ brew install anomalyco/tap/opencode

// gotcha

The npm package is opencode-ai, not opencode — the bare opencode name is a different, unrelated package. If your distro ships an old build, prefer the curl script or the anomalyco tap over the slower system package.

// resources