Wrong installation path #2049

Open
opened 2026-02-16 17:33:55 -05:00 by yindo · 8 comments
Owner

Originally created by @einarpersson on GitHub (Oct 11, 2025).

Originally assigned to: @rekram1-node on GitHub.

The README says

Installation Directory

The install script respects the following priority order for the installation path:

    $OPENCODE_INSTALL_DIR - Custom installation directory
    $XDG_BIN_DIR - XDG Base Directory Specification compliant path
    $HOME/bin - Standard user binary directory (if exists or can be created)
    $HOME/.opencode/bin - Default fallback

But when I run

❯ XDG_BIN_DIR=$HOME/.local/bin curl -fsSL https://opencode.ai/install | bash
Downloading opencode version: 0.14.7 ...
######################################################################## 100.0%
Successfully added opencode to $PATH in /home/einar/.zshenv
❯ cat .zshenv
***REDACTED***
# opencode
export PATH=/home/einar/.opencode/bin:$PATH

❯ which opencode
~/.opencode/bin/opencode
Originally created by @einarpersson on GitHub (Oct 11, 2025). Originally assigned to: @rekram1-node on GitHub. The README says ``` Installation Directory The install script respects the following priority order for the installation path: $OPENCODE_INSTALL_DIR - Custom installation directory $XDG_BIN_DIR - XDG Base Directory Specification compliant path $HOME/bin - Standard user binary directory (if exists or can be created) $HOME/.opencode/bin - Default fallback ``` But when I run ``` ❯ XDG_BIN_DIR=$HOME/.local/bin curl -fsSL https://opencode.ai/install | bash Downloading opencode version: 0.14.7 ... ######################################################################## 100.0% Successfully added opencode to $PATH in /home/einar/.zshenv ``` ``` ❯ cat .zshenv ***REDACTED*** # opencode export PATH=/home/einar/.opencode/bin:$PATH ❯ which opencode ~/.opencode/bin/opencode ```
Author
Owner

@github-actions[bot] commented on GitHub (Oct 11, 2025):

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

  • #1124: This exact feature was requested and implemented - XDG_BIN_DIR support was added to respect the installation directory priority order (OPENCODE_INSTALL_DIR → XDG_BIN_DIR → HOME/bin → HOME/.opencode/bin fallback)

The fact that your XDG_BIN_DIR setting is being ignored suggests this might be a regression or the implementation may not be working as expected. Feel free to ignore if #1124 doesn't address your specific case.

@github-actions[bot] commented on GitHub (Oct 11, 2025): This issue might be a duplicate of existing issues. Please check: - #1124: This exact feature was requested and implemented - XDG_BIN_DIR support was added to respect the installation directory priority order (OPENCODE_INSTALL_DIR → XDG_BIN_DIR → HOME/bin → HOME/.opencode/bin fallback) The fact that your XDG_BIN_DIR setting is being ignored suggests this might be a regression or the implementation may not be working as expected. Feel free to ignore if #1124 doesn't address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 11, 2025):

I think if you do that the env var isnt being passed to the script invocation that only passes it to curl which would have no effect

@rekram1-node commented on GitHub (Oct 11, 2025): I think if you do that the env var isnt being passed to the script invocation that only passes it to curl which would have no effect
Author
Owner

@einarpersson commented on GitHub (Oct 11, 2025):

Well, the snippet is from the README.md

@einarpersson commented on GitHub (Oct 11, 2025): Well, the snippet is from the `README.md`
Author
Owner

@einarpersson commented on GitHub (Oct 11, 2025):

Maybe a sidenote, but is $XDG_BIN_DIR from the spec even? can't find much info about it online when searching. I have seen $XDG_BIN_HOME also but not sure if that is official either? I was also a bit surprised that $HOME/bin is a default but not $HOME/.local/bin, but I'm not an expert in these matters.

User-specific executable files may be stored in $HOME/.local/bin. Distributions should ensure this directory shows up in the UNIX $PATH environment variable, at an appropriate place.

https://specifications.freedesktop.org/basedir-spec/latest/

@einarpersson commented on GitHub (Oct 11, 2025): Maybe a sidenote, but is `$XDG_BIN_DIR` from the spec even? can't find much info about it online when searching. I have seen `$XDG_BIN_HOME` also but not sure if that is official either? I was also a bit surprised that `$HOME/bin` is a default but not `$HOME/.local/bin`, but I'm not an expert in these matters. > User-specific executable files may be stored in $HOME/.local/bin. Distributions should ensure this directory shows up in the UNIX $PATH environment variable, at an appropriate place. https://specifications.freedesktop.org/basedir-spec/latest/
Author
Owner

@rekram1-node commented on GitHub (Oct 11, 2025):

Well, the snippet is from the README.md

facepalm oops okay ill fix, I think the script has a bug in it for this anyways, thx for raising

@rekram1-node commented on GitHub (Oct 11, 2025): > Well, the snippet is from the README.md facepalm oops okay ill fix, I think the script has a bug in it for this anyways, thx for raising
Author
Owner

@rekram1-node commented on GitHub (Oct 12, 2025):

Hmm i think u are right about XDG_BIN_DIR that doesn't look liek its real, someone linked the spec and mentioned it but ig they were mistaken:

https://github.com/sst/opencode/issues/1124

@rekram1-node commented on GitHub (Oct 12, 2025): Hmm i think u are right about `XDG_BIN_DIR` that doesn't look liek its real, someone linked the spec and mentioned it but ig they were mistaken: https://github.com/sst/opencode/issues/1124
Author
Owner

@banksean commented on GitHub (Oct 20, 2025):

The installer script doesn't appear to refer to the OPENCODE_INSTALL_DIR env var anywhere at the moment, though it does unconditionally set INSTALL_DIR=$HOME/.opencode/bin: https://github.com/sst/opencode/blob/6995dab1dcef179d5b38cd114f148da9e8617ade/install#L44

@banksean commented on GitHub (Oct 20, 2025): The installer script doesn't appear to refer to the `OPENCODE_INSTALL_DIR` env var anywhere at the moment, though it does unconditionally set `INSTALL_DIR=$HOME/.opencode/bin`: https://github.com/sst/opencode/blob/6995dab1dcef179d5b38cd114f148da9e8617ade/install#L44
Author
Owner

@rimmer commented on GitHub (Nov 11, 2025):

@rekram1-node it was rolled back here https://github.com/sst/opencode/commit/c87a7469a006b789e7235e03f453bdd52464d9b4, without any note

@rimmer commented on GitHub (Nov 11, 2025): @rekram1-node it was rolled back here https://github.com/sst/opencode/commit/c87a7469a006b789e7235e03f453bdd52464d9b4, without any note
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2049