OpenCode can be installed on macOS, Linux, and Windows using multiple package managers and installation methods.
Quick Install
The fastest way to install OpenCode is using the installation script:
curl -fsSL https://opencode.ai/install | bash
This script automatically detects your platform and installs the latest version.
Prerequisites
Before installing OpenCode, ensure you have:
A modern terminal emulator for the best experience:
API keys for your preferred LLM providers (configured after installation)
Installation Methods
macOS
Linux
Windows
Docker
Homebrew (Recommended) Install from the OpenCode tap for the most up-to-date releases: brew install anomalyco/tap/opencode
Or use the official Homebrew formula (updated less frequently): Node.js Package Managers npm install -g opencode-ai
pnpm install -g opencode-ai
yarn global add opencode-ai
bun install -g opencode-ai
Mise mise use -g github:anomalyco/opencode
Nix For the latest development version: nix run github:anomalyco/opencode
Homebrew brew install anomalyco/tap/opencode
Arch Linux Node.js Package Managers npm install -g opencode-ai
pnpm install -g opencode-ai
yarn global add opencode-ai
bun install -g opencode-ai
Mise mise use -g github:anomalyco/opencode
Nix For the best experience on Windows, we recommend using Windows Subsystem for Linux (WSL) . It provides better performance and full compatibility with OpenCode’s features. Chocolatey Scoop Node.js Package Managers npm install -g opencode-ai
pnpm install -g opencode-ai
yarn global add opencode-ai
Bun support on Windows is currently in progress.
Mise mise use -g github:anomalyco/opencode
Run with Docker docker run -it --rm ghcr.io/anomalyco/opencode
Mount Your Project docker run -it --rm -v $( pwd ) :/workspace ghcr.io/anomalyco/opencode
Use Docker when you want an isolated environment or need to run OpenCode on a system without installing dependencies.
Desktop App (Beta)
OpenCode is also available as a desktop application with a native GUI experience.
Download
Download directly from the releases page or opencode.ai/download .
Platform Download File macOS (Apple Silicon) opencode-desktop-darwin-aarch64.dmgmacOS (Intel) opencode-desktop-darwin-x64.dmgWindows opencode-desktop-windows-x64.exeLinux (Debian/Ubuntu) opencode-desktop-linux-x64.debLinux (Fedora/RHEL) opencode-desktop-linux-x64.rpmLinux (AppImage) opencode-desktop-linux-x64.AppImage
Install via Package Manager
macOS (Homebrew)
Windows (Scoop)
brew install --cask opencode-desktop
scoop bucket add extras
scoop install extras/opencode-desktop
Custom Installation Directory
The installation script respects environment variables for custom installation paths:
# Custom directory
OPENCODE_INSTALL_DIR = /usr/local/bin curl -fsSL https://opencode.ai/install | bash
# XDG compliant path
XDG_BIN_DIR = $HOME /.local/bin curl -fsSL https://opencode.ai/install | bash
Priority Order
$OPENCODE_INSTALL_DIR - Custom installation directory
$XDG_BIN_DIR - XDG Base Directory Specification path
$HOME/bin - Standard user binary directory
$HOME/.opencode/bin - Default fallback
Manual Download
Grab the binary directly from the GitHub Releases page:
Download the appropriate binary for your platform
Extract the archive
Move the binary to a directory in your $PATH
Make it executable: chmod +x opencode
Verify Installation
Confirm OpenCode is installed correctly:
You should see the version number printed to the console.
Upgrading
Homebrew
npm
Chocolatey
Scoop
npm update -g opencode-ai
Remove versions older than 0.1.x before installing or upgrading to avoid compatibility issues.
Uninstalling
To remove OpenCode from your system:
Homebrew
npm
Chocolatey
Scoop
npm uninstall -g opencode-ai
Remove configuration files:
rm -rf ~/.config/opencode
rm -rf ~/.opencode
Next Steps
Quick Start Configure OpenCode and start your first session
Configuration Customize OpenCode to match your workflow