| layout | default |
|---|---|
| title | Chapter 1: Getting Started |
| nav_order | 1 |
| parent | OpenCode Tutorial |
Welcome to Chapter 1: Getting Started. In this part of OpenCode Tutorial: Open-Source Terminal Coding Agent at Scale, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.
This chapter gets OpenCode running and establishes a clean baseline for deeper customization.
- install OpenCode using your preferred package path
- validate local model/provider connectivity
- run first tasks in terminal agent mode
- understand the difference between
buildandplanmodes
| Path | Command | Best For |
|---|---|---|
| install script | `curl -fsSL https://opencode.ai/install | bash` |
| npm | npm i -g opencode-ai@latest |
Node-centric environments |
| Homebrew | brew install anomalyco/tap/opencode |
macOS/Linux package-managed setup |
- launch
opencode - confirm provider credentials are available
- run a simple repo analysis task
- switch between
buildandplanmodes - verify output and suggested edits are coherent
| Symptom | Likely Cause | First Fix |
|---|---|---|
| no model responses | missing provider credentials | configure provider key and retry |
| unsafe command concerns | wrong agent mode for task | use plan mode for analysis-first sessions |
| poor repo understanding | insufficient context scope | add clearer task framing and target files |
You now have OpenCode installed and validated for day-to-day terminal workflows.
Next: Chapter 2: Architecture and Agent Loop
flowchart LR
A[opencode CLI] --> B{Mode}
B -->|build| C[Agent Loop]
B -->|plan| D[Analysis Only]
C --> E[File Tools]
C --> F[Shell Tools]
C --> G[Model Provider]
G --> H[Response / Patch]