Prerequisites
OpenCode requires Go 1.24.0 or higher if building from source. For binary installations, no prerequisites are needed.Install script (recommended)
The install script is the fastest way to get started with OpenCode. It automatically downloads the latest version for your platform and adds it to your PATH.- Detect your OS and architecture (linux/mac, x86_64/arm64)
- Download the appropriate binary to
~/.opencode/bin - Add
~/.opencode/binto your PATH in your shell config file - Display installation success message
After installation, restart your shell or run
source ~/.bashrc (or equivalent) to use OpenCode immediately.Homebrew (macOS and Linux)
If you use Homebrew, you can install OpenCode from our tap:AUR (Arch Linux)
Arch Linux users can install OpenCode from the Arch User Repository using their preferred AUR helper:Go install
If you have Go 1.24.0 or higher installed, you can install OpenCode directly:Build from source
For development or if you want the latest unreleased features:Verify installation
After installation, verify that OpenCode is available:Setup API keys
Before using OpenCode, you need to configure at least one AI provider. OpenCode supports multiple providers and will automatically detect which one to use based on available API keys.OpenCode checks providers in this order: GitHub Copilot → Anthropic → OpenAI → Gemini → Groq → OpenRouter → AWS Bedrock → Azure OpenAI → VertexAI
Set environment variables
The simplest way to configure providers is through environment variables:Configuration file
For more control, create a configuration file at~/.opencode.json or ~/.config/opencode/.opencode.json:
Next steps
Quickstart guide
Run your first AI assistant session
Configuration
Learn about all configuration options