Skip to main content

Overview

The upgrade command updates OpenCode to the latest version or a specific target version. It automatically detects your installation method and uses the appropriate upgrade mechanism.

Usage

Upgrade to Latest

Upgrade to Specific Version

Options

string
Version to upgrade to (e.g., 0.1.48 or v0.1.48). If omitted, upgrades to the latest version.
string
Installation method to use. Short form: -mSupported methods:
  • curl - Shell script installation
  • npm - Node Package Manager
  • pnpm - PNPM package manager
  • bun - Bun package manager
  • brew - Homebrew (macOS/Linux)
  • choco - Chocolatey (Windows)
  • scoop - Scoop (Windows)

Installation Methods

Automatic Detection

OpenCode automatically detects how it was installed:
Output:

Manual Method

Override automatic detection:

Examples

Update to Latest

Specific Version

Force npm Method

Downgrade

You can also downgrade to an earlier version:

Installation Method Details

curl (Shell Script)

For installations via the shell script:
Upgrade:
This re-downloads and installs the latest version.

npm/pnpm/bun

For Node.js package managers:
Upgrade:
This runs the equivalent of npm update -g opencode.

brew (Homebrew)

For macOS and Linux Homebrew installations:
Upgrade:
Runs brew upgrade opencode.

choco (Chocolatey)

For Windows Chocolatey:
Upgrade:
Chocolatey requires an elevated (Administrator) command prompt for upgrades.

scoop (Scoop)

For Windows Scoop:
Upgrade:

Version Detection

Check Current Version

Or:

Already Up to Date

If you’re already on the target version:

Troubleshooting

Unknown Installation Method

Problem: opencode is installed to /path/to/opencode and may be managed by a package manager Solutions:
  • Specify the method explicitly: opencode upgrade --method npm
  • Uninstall and reinstall using a supported method
  • Use your package manager directly
Prompt to install anyway: The command will ask if you want to proceed:
Select “Yes” to install using the default method (curl).

Permission Denied

Problem: Permission errors during upgrade Solutions: macOS/Linux:
Windows (Chocolatey): Run Command Prompt or PowerShell as Administrator:

Network Errors

Problem: Cannot download new version Solutions:
  • Check internet connectivity
  • Verify firewall allows downloads
  • Try again later (registry may be temporarily unavailable)
  • Check proxy settings if behind corporate firewall

Upgrade Failed

Problem: Generic upgrade failure Solutions:
  • Check stderr output for specific error
  • Try a different installation method
  • Manually uninstall and reinstall
  • Report the issue on GitHub

Cannot Find Version

Problem: Specified version doesn’t exist Solutions:
  • Check available versions on GitHub Releases
  • Verify version format (use v0.1.48 or 0.1.48)
  • Omit version to get latest: opencode upgrade

Automatic Updates

By default, OpenCode checks for updates and notifies you:

Disable Auto-Update Checks

Set environment variable:
Or in opencode.json:

Upgrade Strategies

Stable Releases

For production use:

Specific Versions

For consistency across team:
Document the version in your project:

Testing New Releases

Test pre-release versions:
Pre-release versions may have bugs. Don’t use in production.

Post-Upgrade

After upgrading:
  1. Verify version:
  2. Check release notes: Visit GitHub Releases for changelog
  3. Test functionality:
  4. Review breaking changes: Major version upgrades may have breaking changes

Manual Installation

If automatic upgrade fails, manually install:

Shell Script

npm

Homebrew

From Source

Installation

Initial installation guide

Release Notes

View version changelogs

uninstall

Remove OpenCode completely

Troubleshooting

Resolve common issues