Error if Node version is pinned in Homebrew #3784

Open
opened 2026-02-16 17:41:27 -05:00 by yindo · 6 comments
Owner

Originally created by @romado77 on GitHub (Dec 23, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Description

OpenCode depends on Node. Now, Homebrew installs the latest non-LTS Node.js version (25) by default.
When Node.js is pinned (for example to node@24), OpenCode fails to start with the following error:

zsh: /opt/homebrew/bin/opencode: bad interpreter: /opt/homebrew/opt/node/bin/node: no such file or directory

Despite this error, the Node binary is available and accessible at: /opt/homebrew/bin/node

OpenCode version

1.0.191

Steps to reproduce

  1. Uninstall current Node with brew uninstall --ignore-dependencies node
  2. Install node with brew brew install node@24.
  3. Run opencode

Screenshot and/or share link

No response

Operating System

macOS 15.7.3

Terminal

Ghostty

Originally created by @romado77 on GitHub (Dec 23, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description ### Description OpenCode depends on Node. Now, Homebrew installs the latest non-LTS Node.js version (25) by default. When Node.js is pinned (for example to node@24), OpenCode fails to start with the following error: zsh: /opt/homebrew/bin/opencode: bad interpreter: /opt/homebrew/opt/node/bin/node: no such file or directory Despite this error, the Node binary is available and accessible at: /opt/homebrew/bin/node ### OpenCode version 1.0.191 ### Steps to reproduce 1. Uninstall current Node with `brew uninstall --ignore-dependencies node` 2. Install node with brew `brew install node@24`. 3. Run opencode ### Screenshot and/or share link _No response_ ### Operating System macOS 15.7.3 ### Terminal Ghostty
yindo added the bug label 2026-02-16 17:41:27 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 23, 2025):

This issue might be a duplicate of or related to existing Homebrew/Node.js issues. Please check:

  • #5618: Auto-updates not applying correctly in the TUI (Homebrew installation on macOS)
  • #4640: Opencode install with brew breaks npm certificates on MacOS (Homebrew installation issues)
  • #5176: Install script should use XDG_DATA_HOME for binary location (installation path issues)

The root cause appears to be that the OpenCode shebang line is hardcoded to use /opt/homebrew/opt/node/bin/node, but when Node.js is pinned to a specific version (like node@24), Homebrew installs it to a different path. The binary is accessible at /opt/homebrew/bin/node, but the shebang doesn't find it there.

Feel free to ignore if these don't address your specific case.

@github-actions[bot] commented on GitHub (Dec 23, 2025): This issue might be a duplicate of or related to existing Homebrew/Node.js issues. Please check: - #5618: Auto-updates not applying correctly in the TUI (Homebrew installation on macOS) - #4640: Opencode install with brew breaks npm certificates on MacOS (Homebrew installation issues) - #5176: Install script should use XDG_DATA_HOME for binary location (installation path issues) The root cause appears to be that the OpenCode shebang line is hardcoded to use `/opt/homebrew/opt/node/bin/node`, but when Node.js is pinned to a specific version (like node@24), Homebrew installs it to a different path. The binary is accessible at `/opt/homebrew/bin/node`, but the shebang doesn't find it there. Feel free to ignore if these don't address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Dec 23, 2025):

opencode doesnt require node to run I guess this would be a bug with the homebrew formula that the homebrew team maintains?

@rekram1-node commented on GitHub (Dec 23, 2025): opencode doesnt require node to run I guess this would be a bug with the homebrew formula that the homebrew team maintains?
Author
Owner

@romado77 commented on GitHub (Dec 23, 2025):

opencode doesnt require node to run I guess this would be a bug with the homebrew formula that the homebrew team maintains?

It's declared in dependencies https://formulae.brew.sh/api/formula/opencode.json.

"dependencies": [
"node",
"ripgrep"
],

Should I raise defect with homebrew to remove node as dependency?

@romado77 commented on GitHub (Dec 23, 2025): > opencode doesnt require node to run I guess this would be a bug with the homebrew formula that the homebrew team maintains? It's declared in dependencies https://formulae.brew.sh/api/formula/opencode.json. ```json "dependencies": [ "node", "ripgrep" ], ``` Should I raise defect with homebrew to remove node as dependency?
Author
Owner

@rekram1-node commented on GitHub (Dec 23, 2025):

Sure yeah, we ship a single file bun executable so it doesn't have any dep for node.

Now opencode will try to auto install ripgrep if you don't have it installed so I added it to the "official" brew formula since some people complained about this

@rekram1-node commented on GitHub (Dec 23, 2025): Sure yeah, we ship a single file bun executable so it doesn't have any dep for node. Now opencode will try to auto install ripgrep if you don't have it installed so I added it to the "official" brew formula since some people complained about this
Author
Owner

@vladimirven001 commented on GitHub (Feb 11, 2026):

Any updates on this? Still happening with opencode 1.1.50.

@vladimirven001 commented on GitHub (Feb 11, 2026): Any updates on this? Still happening with opencode 1.1.50.
Author
Owner

@rekram1-node commented on GitHub (Feb 11, 2026):

@vladimirven001 use our homebrew tap instead:
brew install anomalyco/tap/opencode

@rekram1-node commented on GitHub (Feb 11, 2026): @vladimirven001 use our homebrew tap instead: `brew install anomalyco/tap/opencode`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3784