An installer script for running opencode on Termux.
opencode is a Go binary compiled against Linux glibc, which cannot run directly on Termux (Bionic libc). This script leverages the official Termux glibc subsystem to provide a compatible runtime.
| Component | Description |
|---|---|
glibc-repo |
Termux's glibc package repository |
glibc-runner |
Provides the grun command to launch glibc binaries in Termux |
unset LD_PRELOAD— avoids conflicts between Termux'stermux-execand glibc- Launches the target binary via glibc's
ld.so - Automatically sets the correct library search paths
NOTE: Do NOT use
grun --configure— it usespatchelfto modify the binary, which causes segfaults with Go binaries like opencode.
bash opencode-termux.sh installbash opencode-termux.sh uninstallAfter installation, opencode will be placed in ~/.opencode/bin/:
opencode— wrapper script (launches viagrun)opencode.real— original opencode binary
| Variable | Default | Description |
|---|---|---|
OPENCODE_VERSION |
latest |
opencode version to install (GitHub release tag) |
Example:
OPENCODE_VERSION="v0.5.0" bash opencode-termux.sh installaarch64(arm64)
MIT