
Install OpenCode (2026): Setup, First Agent, Common Fixes
Published on:
Updated on:
Reading time: 6 min
Topic: Technology
Author: Leandro Valencia
Install OpenCode v2 with npm, bun, pnpm, yarn or the official script, connect a model provider and run your first agent in a repo. Includes install error fixes.
Table of Contents
The posts I've already written about OpenCode are about price and usage ceilings: Go at $10 and Zen vs Go. This one isn't. This one is how to get the program installed and answering inside your repo.
OpenCode is a coding agent that lives in the terminal (TUI). It's not an IDE. It doesn't replace VS Code. It's the piece that opens the project, reads files and proposes changes with whatever model you plug into it.
If you use OpenCode Go, it costs $10 a month from the first month. Go Plus is $40 a month when you need more usage. The $5 first month and the referral credit are gone. The subscription is at opencode.ai/go.
Updated September 30, 2026.
Two names you shouldn't mix up
- OpenCode: the CLI. You install it once. It's free software, runs as
opencode. - OpenCode Go: the $10 a month subscription (Go Plus, $40) with open models and usage ceilings. It's one provider you can connect. It's not required to install the CLI.
You can install OpenCode today and connect Anthropic's API, Z.ai or another. Go is the shortcut if you don't want to manage ten API keys.
Step by step
1. Install the OpenCode CLI
The official v2 doc gives these routes. Pick one:
npm install -g @opencode/cli
bun install -g --trust @opencode/cli
pnpm add -g --allow-build=@opencode/cli @opencode/cli
yarn global add @opencode/cli
curl -fsSL https://opencode.ai/v2/install | bash
The npm package uses a trusted postinstall script to download the native binary for your platform. That's why bun and pnpm ask for the --trust / --allow-build flag.
What not to use, according to that same doc: Homebrew, AUR, Scoop, Chocolatey or a loose .exe from a mirror. 2025 tutorials saying brew install opencode are outdated compared to v2.
If this command fails (postinstall script not run, command not found: opencode, EACCES), jump to the common install errors and their fixes.
Docker exists (ghcr.io/anomalyco/opencode with version tags) if your workflow is containers. For day one, npm or the script is enough.
2. Check that it runs
Close and reopen the terminal (the PATH sometimes doesn't refresh). Then:
opencode
It has to open the TUI, not command not found. If the curl script installed into a directory your shell doesn't load, open a new session or source your .bashrc / .zshrc.
No GPU needed. No need for opencode tui as some magic subcommand: the binary with no arguments launches the interface.
3. Connect a provider
Inside the TUI, the command is:
/connect
There you pick the provider. Reasonable paths:
- OpenCode Go: if you want the $10 plan (or Go Plus at $40) and the open models. Create the account at opencode.ai/go, complete billing, and connect Go from
/connect. Ceiling details are in the pricing post; here all that matters is that the session authenticates. - Z.ai / GLM: if you already have the Coding Plan, connect it as a custom provider with the coding endpoint. Don't mix in the generic chat key.
- Anthropic, OpenAI or another:
/connectand paste the key. OpenCode ships with several built in.
Without a provider, the TUI is an empty shell. The typical day-one error isn't "it won't install": it's opening opencode without having connected anything.
4. Enter a real repo
cd /path/to/your/project
opencode
The agent sees the files in that directory. If you launch it in $HOME, it'll want to opine about your entire disk. Don't do it.
If the project already has an AGENTS.md or an opencode.json, it respects them. If not, you can initialize later; it doesn't block the first prompt.
5. Send the first task
Ask for something you can verify without faith:
- "What does
src/auth.tsdo?" - "Write a test for this function and don't touch the rest."
If it edits the right file and the diff makes sense, the install is done. Only then is it worth talking about MCP, plugins and themes — the customize doc exists for day 2.
If something fails
command not found: PATH. Reopen the terminal. With npm global, the npm prefix is sometimes missing from the Windows PATH.- npm's postinstall got blocked: that's the script that downloads the binary. On bun/pnpm you must have passed
--trust/--allow-build. - Any other install error: the nine failures that actually show up — the postinstall that never runs, the
brew installthat does not exist, the Windows PATH — are each solved in OpenCode won't install: errors and fixes. - The TUI opens but the model doesn't respond: it's not the install, it's
/connect. Check the key and the provider. - Go runs out mid-afternoon: that's the usage ceiling, not a CLI bug. That's explained in the limits post.
Frequently asked questions
Are OpenCode and OpenCode Go the same thing?
No. CLI vs model subscription. You can use the CLI without Go.
Can I install it with Homebrew or Scoop?
Not according to the v2 doc. npm/bun/pnpm/yarn or the opencode.ai/v2/install script.
Do I need a powerful GPU?
Not for Go or for cloud APIs.
How much does OpenCode Go cost?
$10 a month from the first charge. Go Plus is $40 a month. Limit details are in the pricing post. There is no referral credit.
In short
- Install the CLI through the official v2 route, not through some blog's brew.
/connectis the step people skip.- Launch
opencodeinside the repo. - Go is optional: $10 a month, or $40 on Go Plus.
- Prices and ceilings: the other two posts.
The plan, if you want it, is at OpenCode Go.
If you're putting together your AI coding toolkit and are going to pay for licenses or subscriptions, at Eneba you get 5% off with my link. It's an affiliate link: it costs you less and it helps me keep the blog running. And if it's for your team, here I explain how to buy cheap software licenses on Eneba. The 5% applies with the code CreaCosas at checkout, as long as you arrive through the link.
If you already have the agent in your head and what's missing is "making it run on this machine", you don't need another comparison. You need an install the official docs still back.
— Leandro Valencia
Step-by-step guide
Install the OpenCode CLI
npm, bun, pnpm, yarn or the official v2 script. Homebrew and Scoop are not supported.
Check that it runs
Open a new terminal and run opencode. It should open the TUI, not a PATH error.
Connect a provider
In the TUI, /connect. Go is optional: $10 a month, or Go Plus at $40 if you need more usage.
Enter a real repo
cd into the project and launch opencode again. The agent works on those files.
Send the first task
Ask for something short and verifiable. If it edits the right file, the install is done.
Frequently asked questions
Are OpenCode and OpenCode Go the same thing?
No. OpenCode is the CLI/TUI (the program you install). OpenCode Go is a plan of about $10 a month that gives you access to open models to use *inside* that CLI. You can install OpenCode and connect Anthropic, OpenAI or another provider without paying for Go.
Can I install it with Homebrew or Scoop?
The official v2 documentation says Homebrew, AUR, Windows package managers and loose binaries are not supported. Use npm, bun, pnpm, yarn or `curl -fsSL https://opencode.ai/v2/install | bash`.
Do I need a powerful GPU?
No. Go's models and cloud providers run outside your machine. A terminal and a stable connection are enough. If you connect a local model (Ollama, etc.), that's when hardware comes in; that's not the path of this onboarding.
How much does OpenCode Go cost?
$10 a month from the first month. Go Plus is $40 a month, with the same models and higher limits. The referral program has ended, so a link no longer grants credit. The CLI installs for free without a subscription.
Related Posts
Keep exploring similar content that may interest you

OpenCode vs Claude Code: Price, Models and Limits in 2026
OpenCode vs Claude Code in 2026: OpenCode Go from 10 USD versus Claude Pro from 20 USD, which models each one uses, how their limits work and when to pick which.

Manus vs Claude Code vs OpenCode: Pricing and Which to Pick (2026)
Manus works in the cloud; Claude Code and OpenCode work on your machine. We compare pricing, how each one bills, key features and which fits your profile.

Claude Code: 2026 Guide to Getting Started, Installing and Using It
What Claude Code is, how to install it on macOS, Linux and Windows, which plan you need, which model to use and how to extend it with skills, plugins and MCP.
Partnerships
Tools I use every day, on better terms for this community.