Overview
Theupgrade 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
Version to upgrade to (e.g.,
0.1.48 or v0.1.48). If omitted, upgrades to the latest version.Installation method to use. Short form:
-mSupported methods:curl- Shell script installationnpm- Node Package Managerpnpm- PNPM package managerbun- Bun package managerbrew- Homebrew (macOS/Linux)choco- Chocolatey (Windows)scoop- Scoop (Windows)
Installation Methods
Automatic Detection
OpenCode automatically detects how it was installed: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:npm/pnpm/bun
For Node.js package managers:npm update -g opencode.
brew (Homebrew)
For macOS and Linux Homebrew installations:brew upgrade opencode.
choco (Chocolatey)
For Windows Chocolatey:scoop (Scoop)
For Windows Scoop:Version Detection
Check Current Version
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
Permission Denied
Problem: Permission errors during upgrade Solutions: macOS/Linux: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.48or0.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:opencode.json:
Upgrade Strategies
Stable Releases
For production use:Specific Versions
For consistency across team:Testing New Releases
Test pre-release versions:Post-Upgrade
After upgrading:-
Verify version:
- Check release notes: Visit GitHub Releases for changelog
-
Test functionality:
- Review breaking changes: Major version upgrades may have breaking changes
Manual Installation
If automatic upgrade fails, manually install:Shell Script
npm
Homebrew
From Source
Related Topics
Installation
Initial installation guide
Release Notes
View version changelogs
uninstall
Remove OpenCode completely
Troubleshooting
Resolve common issues