The install command for the current OpenCode 2 line on the official install page (read 13 November 2026) is curl -fsSL https://opencode.ai/v2/install | bash on macOS and Linux. On native Windows the same page says package managers are not supported and points to a standalone binary download. The lines that the opencode.asia and open-code.ai guides print (the /install script path, npm install -g opencode-ai, brew install opencode, Scoop and Chocolatey) are not in the route list on that page. The newest tag on the project’s GitHub container registry page, read on 13 November 2026, is 2.2.7.
Don't miss new tech stories on Google
Add Tech Insider once in the Google app and our stories appear in your news suggestions.
The command you paste decides the generation, and older tutorials paste the wrong one
Two generations share the OpenCode name, and the command you paste decides which one lands on your machine. The official page lists these routes for OpenCode 2: curl script, Homebrew, npm, Bun, pnpm, Yarn, Vite+, AUR and mise. The table sets every command in circulation against that list and names the source that makes each claim, so you can see which rows only a mirror or community guide supports.
| Command | What the source says it gives | Listed in the official V2 docs? | Source |
|---|---|---|---|
curl -fsSL https://opencode.ai/v2/install | bash | The OpenCode 2 script for macOS and Linux | Yes | opencode.ai/docs |
curl -fsSL https://opencode.ai/install | bash | A different URL from the V2 script; this is the path the opencode.asia community guide uses | No | opencode.asia quick start |
brew install anomalyco/tap/opencode-v2 | The Homebrew formula the V2 docs name | Yes | opencode.ai/docs |
brew install anomalyco/tap/opencode | Tap formula that open-code.ai recommends as most up to date; its name differs from the V2 formula | No | open-code.ai (unofficial mirror) |
brew install opencode | The Homebrew team’s own formula, updated less frequently | No | open-code.ai (unofficial mirror) |
npm install -g @opencode/cli | The V2 package name | Yes | opencode.ai/docs |
bun install -g --trust @opencode/cli | The V2 package, with the flag that lets its postinstall script run | Yes | opencode.ai/docs |
pnpm add -g --allow-build=@opencode/cli @opencode/cli | The V2 package, with the flag that allows its build script | Yes | opencode.ai/docs |
npm install -g opencode-ai | Older package name; open-code.ai lists it for Windows | No | open-code.ai |
choco install opencode, scoop install opencode | The V2 docs say Windows package managers are not supported; open-code.ai still lists both | No | opencode.ai/docs, open-code.ai |
mise use -g opencode | Needs mise 2026.10.9 or later; older versions install OpenCode 1 | Yes | opencode.ai/docs |
mise use -g github:anomalyco/opencode | The mise line open-code.ai prints among its Windows options | No | open-code.ai |
docker run -it --rm ghcr.io/anomalyco/opencode | Images use versioned tags such as 2.0.0; the registry page shows 2.2.7 as the latest | Yes (tags documented) | opencode.ai/docs/index.md, GitHub container page |
sudo pacman -S opencode, paru -S opencode-bin | Arch lines from open-code.ai, which gives pacman as stable and the paru package as the latest AUR build | AUR route yes; these exact lines not shown in the route list | open-code.ai, opencode.ai/docs |
Whichever route you use, finish with a version check. The docs give 2.0.0 as an example tag and the registry page shows 2.2.7 as the latest, so a 1.x number means an older route put OpenCode 1 on the machine. The changelog, checked on 13 November 2026, lists v2.2.6 (6 November 2026) and then v2.2.7 (10 November 2026) as the newest OpenCode 2 releases, and v1.19.5 (28 October 2026) is still the last 1.x entry shown. Upgrading an existing install is a separate step: the OpenCode changelog says upgrading to OpenCode 2 remains a separate, explicit choice through the offer in /update or opencode upgrade --major, and the 1.x installation script refuses to install 2.x versions. Tech Insider has a separate article on the OpenCode 2.x release.
curl -fsSL https://opencode.ai/v2/install | bash
opencode --version
One command per OS, and why native Windows gets a binary instead
macOS and Linux
The curl script above is the shortest route. If you prefer Homebrew, the V2 docs name the opencode-v2 formula in the OpenCode tap. open-code.ai notes that the Homebrew team’s own opencode formula is updated less frequently than the tap, which is one more reason not to mix the two.
brew install anomalyco/tap/opencode-v2
opencode --version
OpenCode is a terminal interface, so use a modern terminal emulator. open-code.ai names WezTerm, Alacritty, Ghostty and Kitty as examples.
npm, Bun, pnpm, Yarn and Vite+
The V2 npm package is @opencode/cli, not opencode-ai. According to the docs, the package “uses a postinstall script to select the native opencode binary for your platform”. The Bun and pnpm commands explicitly allow that script (--trust for Bun, --allow-build for pnpm), and Vite+ needs no extra flag. Yarn uses yarn global add @opencode/cli and Vite+ uses vp install -g @opencode/cli, both from the docs page.
npm install -g @opencode/cli
bun install -g --trust @opencode/cli
pnpm add -g --allow-build=@opencode/cli @opencode/cli
opencode --version
The opencode.asia community guide cites Node.js 18 or later only for some language servers.
Arch Linux and mise
The V2 page has an AUR tab, so take the package name from there. The pacman and paru lines in open-code.ai’s guide are not on the V2 route list. For mise, the docs say the command “requires mise 2026.10.9 or later; older versions install OpenCode 1”. Check your mise version before you run the line from the docs page.
mise --version
opencode --version
Windows
The V2 page states: “Windows package managers are not supported. Download a standalone CLI binary for your platform.” Pick the ARM64, x64 or x64 baseline build from the table below, put it in a folder on your PATH, then open a new terminal and run opencode --version. The alternative is WSL: open-code.ai recommends it for better performance and full compatibility, and the community guide lists WSL2 as supported. Inside a WSL shell you are running Linux, so the macOS and Linux command is the one that applies.
Picking the standalone binary
| Platform | Standalone CLI variants offered |
|---|---|
| macOS | Apple silicon, Intel, Intel (baseline) |
| Windows | ARM64, x64, x64 (baseline) |
| Linux (glibc) | ARM64, x64, x64 (baseline) |
| Linux (musl) | ARM64, x64, x64 (baseline) |
On Linux, match the glibc or musl build to your distribution’s C library. The x64 (baseline) build is listed separately from plain x64, so try it if the plain x64 binary refuses to start.
Terminal, desktop app, browser link or IDE terminal: which front end to open
The docs describe OpenCode as available as a terminal interface, a desktop app or a web app. The terminal is what every command above installs. The desktop app is a separate download:
| Platform | Desktop build |
|---|---|
| macOS | Apple silicon, Intel |
| Windows | x64, ARM64 |
| Linux (.deb) | x64, ARM64 |
| Linux (.rpm) | x64, ARM64 |
| Linux (AppImage) | x64, ARM64 |
For the browser, run opencode pair. The docs show it printing a link to connect, and the CLI commands page says it prints one-time links plus a QR code of the first one. Links expire after 5 minutes and work once, so run the command again if the link has lapsed.
For an editor, the V1 IDE docs say OpenCode integrates with VS Code, Cursor or any IDE that supports a terminal, and that running opencode in the terminal is enough to start. The extension is installed from the editor’s Extension Marketplace (search for OpenCode and click Install) in VS Code and forks such as Cursor, Windsurf and VSCodium. The V1 page lists the quick-launch shortcut, and the IDE docs page lists the other two:
- Quick launch: Cmd+Esc on Mac, Ctrl+Esc on Windows and Linux, opens OpenCode in a split terminal or focuses a running session.
- New session: Cmd+Shift+Esc on Mac, Ctrl+Shift+Esc on Windows and Linux.
- File reference: Cmd+Option+K on Mac, Alt+Ctrl+K on Windows and Linux, inserts a file reference such as
@File#L37-42.
If the extension misbehaves, the V1 page says to confirm you are running opencode in the integrated terminal, check that the extension is installed and enabled in the Extensions view, and restart the integrated terminal.
For a server instead of a laptop, Akamai’s Quick Deploy app for OpenCode installs it on an Ubuntu 24.04 LTS server, with an estimated deployment time of 5-10 minutes on any plan type or size. OpenCode is installed for the root user only; you run opencode from your project directory, or connect from your own machine with /attach over an SSH tunnel. For CI or sandboxes, the container image is published under ghcr.io/anomalyco/opencode; pin a tag, for example 2.2.7, instead of relying on an unversioned pull. The registry page lists an MIT License and 227k stars as of 13 November 2026.
docker run -it --rm ghcr.io/anomalyco/opencode:2.2.7
First launch: confirm the version, /connect a model, /init, and plan before you build
- Open a terminal in the project you want to work on and run
opencode. Runopencode --versionfirst if you have not checked the generation yet. - Connect a model. The docs say you can connect to the supported LLM providers directly in the TUI with
/connect. The community guide adds that keys entered throughopencode auth loginare stored in~/.local/share/opencode/auth.json, and that an API key is optional with the built-in models. - Run
/init. OpenCode analyses the project and creates an AGENTS.md file in the project root; open-code.ai advises committing it to Git. - Press Tab to switch between the default build agent (full access) and the read-only plan agent. open-code.ai describes Plan mode as disabling changes and only suggesting how it would implement a feature. If a change goes wrong,
/undoreverts it and/redoreapplies it.
cd /path/to/project
opencode
Three more commands from the TUI docs are worth knowing from the first session. /models switches the active model, including in the middle of a session. /editor opens the current prompt in an external editor: set VISUAL or EDITOR, then press Ctrl+X followed by E, or run /editor. Typing @ fuzzy-searches the project for a file to reference in a prompt, for example @src/api/index.ts.
On providers, the providers page of the official docs says OpenCode uses the AI SDK and Models.dev to support 75+ LLM providers and can run local models. The page covers sign-in options such as ChatGPT Plus/Pro as well as an API key for OpenAI, AWS access keys, a named profile or a bearer token for Amazon Bedrock, one OpenRouter key for many vendors, and a Google Cloud project for Vertex AI.
On cost, the V2 docs mention OpenCode Go, a $10/month subscription for access to coding models. As of 13 November 2026 the V2 docs describe OpenCode Console as a list of models tested and verified by the OpenCode team, while the V1 docs recommend a curated list under the name OpenCode Models. If you already pay a provider, connect that key instead; none of these is required to install.
One older habit no longer works: as of 13 November 2026, the changelog says session sharing has been discontinued (v1.19.1, 15 October 2026), so existing share links and session-sharing commands are no longer available. That includes /share.
Config files, MCP servers and agents, and the settings that changed in V2
The V2 config docs, read on 13 November 2026, say OpenCode searches from the current directory to the filesystem root, first merging direct opencode.json(c) files from the farthest directory to the closest. That is wider than the older rule of stopping at the nearest Git directory. The global file is still ~/.config/opencode/opencode.json(c), but the autoupdate key is now update, with “notify” as the default.
The V1 config docs put a project file at opencode.json in the repository, and say the files merge rather than replace each other. They list this precedence from lowest to highest:
- Remote config from
.well-known/opencode, for organizational defaults - Global config
- A custom file named by the
OPENCODE_CONFIGenvironment variable - Project config
- The
.opencodedirectories, for agents, commands and plugins - Inline config from the
OPENCODE_CONFIG_CONTENTenvironment variable
export OPENCODE_CONFIG=/path/to/my/custom-config.json
Keybinds are where V1 and V2 part ways. In V1 they live in tui.json. As of 13 November 2026, the V2 CLI config page says OpenCode stores CLI settings in one global file, ~/.config/opencode/cli.json, and V2 has no project-local CLI settings file. The V1 TUI docs use ctrl+x as the default leader key, and these defaults:
| Action | Default keybind (V1 docs) |
|---|---|
| Leader key | ctrl+x |
| Command palette | ctrl+p |
| Cycle primary agent | tab (shift+tab reverses) |
| New session | <leader>n |
| List sessions | <leader>l |
| List models | <leader>m |
| Interrupt the agent | escape |
| Undo / redo | <leader>u / <leader>r |
For MCP, the MCP servers docs say that as of 13 November 2026 servers go under mcp.servers rather than directly under mcp. They also say servers connect automatically and to use disabled, not an enabled field, to keep one configured without connecting it, so an enabled: false entry follows the older syntax. The English MCP page adds that MCP supports local and remote servers. For a remote server that needs OAuth, OpenCode detects the 401 response, starts the OAuth flow, uses Dynamic Client Registration if the server supports it, and stores tokens for later requests. Each enabled MCP server also adds its tool definitions to the model’s context window, so enable only the servers you use.
On agents, the agents docs describe Build and Plan as primary agents. They describe two built-in subagents: General, which handles research and multi-step work with broad tool access but cannot launch more subagents, and Explore, which searches and reads code or web sources without editing files. You can invoke a subagent with an @ mention. Custom agents are defined in JSON in the config or as Markdown files, with their own prompt, model and permissions.
| Setting | Earlier version of this guide | Official docs, 13 November 2026 |
|---|---|---|
| Curated model option | OpenCode Zen | OpenCode Console in the V2 docs, plus the $10/month OpenCode Go plan |
| Config lookup | Current directory up to the nearest Git root | Current directory up to the filesystem root |
| Auto-update key | autoupdate | update, default “notify” |
| Keybind settings file | tui.json | ~/.config/opencode/cli.json, global only |
| Session sharing | /share link | Discontinued (v1.19.1, 15 October 2026) |
| MCP servers | Directly under mcp | Under mcp.servers |
| Disabling an MCP server | enabled: false | disabled: true |
Symptom, cause, fix: when the install goes wrong
| Symptom | Likely cause | Fix |
|---|---|---|
opencode: command not found | The shell has not picked up the updated PATH | Close and reopen the terminal or source your shell profile, then run which opencode (macOS, Linux) or where.exe opencode (Windows PowerShell) |
opencode --version prints a 1.x number | An older route installed OpenCode 1: a package-manager line from an older tutorial, or mise older than 2026.10.9 | Reinstall with a route from the table above marked Yes, then check the version again |
| Bun or pnpm install finishes but the binary does not work | The postinstall script that selects the native binary may not have run | Use the Bun or pnpm command from the docs page, which allows the script (--trust for Bun, --allow-build for pnpm) |
| A Windows package manager install fails or gives the wrong build | The V2 docs do not support Windows package managers | Download the standalone binary for your CPU, or install inside WSL and use the Linux command |
| The Linux binary will not start | Wrong libc or CPU variant | Match glibc or musl to your distribution, and try the x64 (baseline) build if plain x64 refuses to start |
opencode pair link does not open the session | Links work once and expire after 5 minutes | Run opencode pair again and open the new link |
| IDE extension does not appear or work | Not in the integrated terminal, or the extension is not installed or enabled | Follow the V1 IDE steps above: run opencode in the integrated terminal, check the Extensions view, restart the integrated terminal |
| Config changes do not apply | Wrong file, or a file in a closer directory overrides it | Check where V2 merges config (farthest directory to closest) and the V1 precedence list above |
| An MCP server will not stay off, or its entry is ignored | Old enabled: false syntax, or servers placed directly under mcp | Move entries under mcp.servers and use disabled: true |
/share does nothing | Session sharing has been discontinued | Stop using share links; the changelog lists the feature as removed in v1.19.1 |
Docs read on 13 November 2026: OpenCode 2 commands, binaries, desktop builds and config lookup from opencode.ai/docs; CLI settings from dev.opencode.ai/docs/cli/config; OpenCode 1 keybind, precedence and IDE material from opencode.ai/v1/docs and dev.opencode.ai/v1/docs/ide; TUI commands from opencode.ai/docs/cli/tui; IDE shortcuts from docs.opencode.ai/docs/ide; MCP and agent settings from dev.opencode.ai/docs; release entries, session sharing and upgrade notes from opencode.ai/changelog.xml and dev.opencode.ai/changelog.xml.





