-
Notifications
You must be signed in to change notification settings - Fork 5
Installation
Install the OpenCode CLI so the OpenCode Walkthrough VS Code extension can dispatch commands and open interactive sessions.
Official reference: opencode.ai/docs · opencode.ai/download
- Prerequisites
- Quick install
- Install by platform
- Verify installation
- Configure providers
- Initialize a project
- Use with this extension
- Related articles
- A modern terminal (WezTerm, Alacritty, Ghostty, Kitty, or VS Code’s integrated terminal).
- API keys or accounts for the LLM providers you plan to use (or OpenCode Zen via
/connect).
On Windows, the OpenCode team recommends WSL for the best terminal experience. Native Windows installs work via npm, Scoop, Chocolatey, or the Windows x64 installer.
curl -fsSL https://opencode.ai/install | bashnpm install -g opencode-aiThe npm package name is
opencode-ai, notopencode.
Then verify:
opencode --version| Platform | Command / link |
|---|---|
| Install script (macOS / Linux) | curl -fsSL https://opencode.ai/install | bash |
| npm | npm install -g opencode-ai |
| Bun | bun install -g opencode-ai |
| pnpm | pnpm install -g opencode-ai |
| Yarn | yarn global add opencode-ai |
| Homebrew (macOS / Linux) | brew install anomalyco/tap/opencode |
| Arch Linux |
sudo pacman -S opencode or paru -S opencode-bin
|
| Windows — npm | npm install -g opencode-ai |
| Windows — Scoop | scoop install opencode |
| Windows — Chocolatey | choco install opencode |
| Windows — Mise | mise use -g github:anomalyco/opencode |
| Windows — installer | Download x64 |
| Docker | docker run -it --rm ghcr.io/anomalyco/opencode |
| GitHub Releases | github.com/anomalyco/opencode/releases |
- Do not use
sudoin PowerShell — it is not available on Windows. - If
opencodeis not found afternpm install -g opencode-ai, add your global npmbinfolder to PATH (often%APPDATA%\npm). - From the extension: run OpenCode: Install CLI — on Windows it runs
npm install -g opencode-aiwith youropencode.*env settings prefixed.
See Troubleshooting for PATH, shell, and env-var issues.
opencode --versionExpected: a version string (e.g. 1.17.9).
Check configured providers:
opencode auth lsIf you see 0 credentials, continue to Configure providers.
OpenCode supports many LLM providers. You need at least one before running prompts.
- Start interactive mode:
opencode - Run
/connect, select opencode, and open opencode.ai/auth - Sign in, add billing, copy your API key, and paste it in the TUI
opencode auth loginOr from VS Code: OpenCode: Auth Login (Command Palette).
Full provider list: opencode.ai/docs — Providers
In your project directory:
cd /path/to/your/project
opencodeInside the TUI:
/init
OpenCode analyzes the repo and creates AGENTS.md at the project root. Commit that file to Git so agents understand your project structure and conventions.
After the CLI is installed and authenticated:
| Step | Action |
|---|---|
| 1 | Install the OpenCode Walkthrough extension (or run npm run run from this repo) |
| 2 | Open a trusted workspace folder |
| 3 | Open the OpenCode activity bar → run Show Walkthrough |
| 4 | Optional: set opencode.* settings in VS Code — they map to OPENCODE_* env vars when commands run in the terminal |
Local development of this extension:
git clone https://github.com/aadorian/opencodeCLI.git
cd opencodeCLI
npm install
npm run run- Troubleshooting & FAQ — PATH, env vars, terminal shells
- OpenCode docs — Intro
- OpenCode docs — Windows
- OpenCode download page