Skip to content

cli: upgrade fails to detect Homebrew install from homebrew-core #52699

Closed

Description

@beijersb

Summary

Installation-method detection fails for OpenCode installed from homebrew-core (brew install opencode), so /update and opencode upgrade abort with installation method not found even though brew is a supported --method.

Environment

  • opencode version: v2.0.20
  • OS: Darwin 25.6.0 (darwin arm64)
  • Terminal: WezTerm (TERM=xterm-256color, COLORTERM=truecolor)
  • Shell: /opt/homebrew/bin/bash
  • Install/channel: release, Homebrew formula opencode from homebrew-core
  • Active plugins: None found in config

Reproduction

  1. brew install opencode (the homebrew-core formula, not the opencode-beta/opencode-v2 tap)
  2. which opencode → /opt/homebrew/bin/opencode
  3. readlink /opt/homebrew/bin/opencode → ../Cellar/opencode/2.0.20/bin/opencode
  4. Run opencode upgrade, or /update inside the TUI

Expected Behavior

Detection returns brew and the upgrade runs brew upgrade opencode.

Actual Behavior

CLI:

Could not detect the installation method. Pass --method to choose how to upgrade OpenCode.

TUI /update:

update skipped: installation method not found
Installation method not found

opencode upgrade --method brew works, so only auto-detection is broken.

Additional Context

The Homebrew branch of the detector only matches two tap names:

const p = await fs.realpath(process.execPath)
if (["opencode-beta", "opencode-v2"].some(v => p.includes(`${path.sep}Cellar${path.sep}${v}${path.sep}`)))
  return "brew"
if (!packageName) return // → undefined → "installation method not found"

The homebrew-core formula installs to a third path that is not covered:

/opt/homebrew/Cellar/opencode/2.0.20/bin/opencode
                      ^^^^^^^^^^^ not matched

/Cellar/opencode/<version>/ matches neither opencode-beta nor opencode-v2, so the check falls through. The subsequent npm/pnpm/bun/yarn/vp probes never run because packageName is only derived from a neighbouring package.json, which does not exist for a standalone Homebrew binary — so the detector returns undefined.

Suggested fix: also match ${path.sep}Cellar${path.sep}opencode${path.sep}, or derive brew from brew --prefix opencode / a HOMEBREW_PREFIX env check.

Reproducible every time on this machine. Workaround: run opencode upgrade --method brew from a terminal (/update in the TUI has no --method option).

Activity

  1. github-actions commented on Oct 2, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The Bug Report template's required Description field is missing. The issue has a Summary instead; please add a substantive Description field. The existing reproduction and environment details are helpful.

    Please edit this issue to address the above within 72 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    • #49660: /update cannot detect the package-manager installation method.
    • #51604: updater reports “installation method not found” for an npm install.

    If you believe this was flagged incorrectly, please let a maintainer know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs:complianceThis means the issue will auto-close after 2 hours.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions