Opencode Install
# OpenCode Installation
OpenCode is an open-source AI coding agent that supports completing development tasks such as code understanding, modification, and execution directly in the terminal.
Compared to traditional AI tools, OpenCode can participate directly in the development process rather than just generating code.
Before installation, ensure your environment meets the following requirements:
### 1. Operating System Requirements
* macOS
* Linux
* Windows (WSL recommended)
### 2. Terminal Tool
A modern terminal is required, for example:
* WezTerm (Cross-platform): [https://wezterm.org/](https://wezterm.org/)
* Alacritty (Cross-platform): [https://alacritty.org/](https://alacritty.org/)
* Ghostty (Linux/macOS): [https://ghostty.org/](https://ghostty.org/)
* Kitty (Linux/macOS): [https://github.com/kovidgoyal/kitty](https://github.com/kovidgoyal/kitty)
### 3. API Key
OpenCode itself does not provide models; you need to configure an AI service provider (details will be explained later):
* OpenAI (GPT)
* Anthropic (Claude)
* Google (Gemini)
* DeepSeek
* AlibabaBailian
* GLM
* MiniMax
* * *
## Installation Methods
OpenCode provides multiple installation methods, with the official script being recommended first.
## 1. One-click Installation (Recommended)
```bash
curl -fsSL https://opencode.ai/install | bash
Explanation:
* Automatically downloads the latest version
* Automatically configures the environment
* Works on macOS / Linux / WSL
After installation, it will prompt how to use it. OpenCode includes a free mode, usage method:
```bash
cd # Enter project directory
opencode # Start OpenCode
!(#)
### 2. Install Using Node.js
If you are familiar with Node.js, you can use:
```bash
npm install -g opencode-ai
Or:
```bash
pnpm install -g opencode-ai
Or:
```bash
yarn global add opencode-ai
### 3. macOS (Homebrew)
```bash
brew install anomalyco/tap/opencode
Explanation:
* Recommended to use the official tap (updates faster)
* `brew install opencode` updates more slowly
### 3. Windows Installation
### Recommended Method: WSL
Reasons:
* More stable
* Full support for all features
Using Chocolatey:
```bash
choco install opencode
Using Scoop:
```bash
scoop install opencode
Using NPM:
```bash
npm install -g opencode-ai
Using Mise:
```bash
mise use -g github:anomalyco/opencode
Using Docker:
```bash
docker run -it --rm ghcr.io/anomalyco/opencode
You can also download the binary file directly from the Releases page [https://github.com/anomalyco/opencode/releases](https://github.com/anomalyco/opencode/releases).
### 4. Linux Installation
General method (recommended):
```bash
curl -fsSL https://opencode.ai/install | bash
Arch Linux:
```bash
sudo pacman -S opencode
Or:
```bash
paru -S opencode-bin
Docker (Advanced):
```bash
docker run -it --rm ghcr.io/anomalyco/opencode
* * *
## Verify Installation
After installation, execute:
```bash
opencode --version
If the output looks like:
1.1.50
It means the installation was successful.
* * *
## Launch OpenCode
Simply run:
```bash
opencode
> If you encounter **EACCES: permission denied, open ''**, it's a permissions issue. We can fix the directory permissions:
>
> ```bash
> sudo chown -R $(whoami) ~/.local
> ```
>
> Then execute:
>
> ```bash
> chmod -R 755 ~/.local
> ```
You will see the terminal interface (TUI):
!(#)
After opening, you can ask questions in this interface.
YouTip