Skip to content

Alternative Installation Methods

The official curl ... | bash script doesn't work for you? Here are other options.


When to Use This Page

  • Official installation script times out
  • You prefer package managers (npm, Homebrew, Scoop, etc.)
  • Company computer has installation restrictions
  • You want to try Docker without installing on your system

macOS / Linux

bash
brew install anomalyco/tap/opencode

Note

The official Homebrew formula is anomalyco/tap/opencode. The community-maintained brew install opencode updates slowly and is not recommended.

npm / pnpm / bun / yarn

Requires Node.js 18+ (22+ recommended).

bash
npm install -g opencode-ai
bash
pnpm install -g opencode-ai
bash
bun install -g opencode-ai
bash
yarn global add opencode-ai

Arch Linux

bash
sudo pacman -S opencode    # Stable version (recommended)
paru -S opencode-bin       # AUR latest version

Windows

Chocolatey

Run PowerShell as Administrator:

powershell
choco install opencode

Run as regular user:

powershell
scoop bucket add extras
scoop install extras/opencode
Haven't installed Scoop?

Run the following commands in order:

powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
powershell
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
powershell
scoop install git

If your PowerShell is running as Administrator, use this instead when installing Scoop:

powershell
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"

npm

Requires Node.js 18+:

powershell
npm install -g opencode-ai

Mise

powershell
mise use -g github:anomalyco/opencode

Docker (Great for Trying Out)

Don't want to install on your system? Try with Docker:

bash
docker run -it --rm ghcr.io/anomalyco/opencode

Limitation

OpenCode running in Docker can only access files inside the container by default. If you want it to read/write files on your computer, you need to mount a directory:

bash
docker run -it --rm -v $(pwd):/workspace -w /workspace ghcr.io/anomalyco/opencode

Not very beginner-friendly. Recommend using the one-line script or package manager first.


Manual Download

Download the binary for your platform from GitHub Releases, extract it, and place it in a PATH directory.


Installation Script Advanced Parameters

The official installation script curl -fsSL https://opencode.ai/install | bash supports these parameters:

bash
# Install a specific version
curl -fsSL https://opencode.ai/install | bash -s -- --version 1.1.6

# Don't modify shell config (don't auto-add to PATH)
curl -fsSL https://opencode.ai/install | bash -s -- --no-modify-path

# Install from local binary
./install --binary /path/to/opencode

Installation Location

The official script installs to $HOME/.opencode/bin by default. To install elsewhere, move the binary after installation:

bash
# Move to /usr/local/bin after installation
sudo mv ~/.opencode/bin/opencode /usr/local/bin/opencode

Installation Locations

MethodBinary LocationConfig Location
Official Script~/.opencode/bin/opencode~/.config/opencode/opencode.json
npm/pnpm/bun/yarnGlobal node_modulesSame as above
Homebrew/opt/homebrew/bin/opencode or /usr/local/bin/opencodeSame as above
Scoop~/scoop/apps/opencode/current/opencode.exeSame as above
ChocolateyC:\ProgramData\chocolatey\bin\opencode.exeSame as above

Next Steps

After installation, go back to 1.2 Installation and follow the "Verify Installation" step to confirm opencode --version outputs correctly.

If you encounter issues, see 1.2b Troubleshooting Installation