Run OpenCode — the terminal AI coding assistant — natively on Termux (Android).
No proot. No Ubuntu container. No glibc. Just one Android program that runs directly in
Termux, installs like a normal package, and starts with the opencode command.
Built for arm64 Android phones on Android 9 (API 28) or newer.
Open Termux and paste this:
pkg install -y curl
curl -fsSL https://github.com/raw/deepsingh132/opencode-termux/native-android/scripts/termux-upgrade.sh -o termux-upgrade.sh
bash termux-upgrade.shThat one script does everything: installs any missing tools, downloads the latest OpenCode, builds it for your phone, installs it, and prints the version when it is done.
Then run:
opencode # open the interactive app (TUI)
opencode run "hi" # ask a single questionbash termux-upgrade.sh --releaseThis installs the newest ready-made package from Releases — no compiling, much faster.
Before you start
Run the same script again — it always picks up the latest version:
bash termux-upgrade.sh # rebuild the latest
bash termux-upgrade.sh --release # install the latest prebuilt packageInstall a specific version:
bash termux-upgrade.sh 1.18.31| Command | What it does |
|---|---|
bash termux-upgrade.sh |
Build and install the latest version |
bash termux-upgrade.sh <version> |
Build and install a specific version |
bash termux-upgrade.sh --release |
Don't build; install the latest prebuilt .deb |
bash termux-upgrade.sh --no-install |
Build the package but don't install it |
bash termux-upgrade.sh --force |
Rebuild even if the version is already installed |
bash termux-upgrade.sh --pacman |
Also create a pacman package |
bash termux-upgrade.sh --no-pull |
Don't update the repo before building |
bash termux-upgrade.sh --help |
Show help |
The script can be run from anywhere. If it is not inside a copy of this project, it
clones the project to ~/opencode-termux first. Once cloned, you can also run
~/opencode-termux/scripts/termux-upgrade.sh directly.
Download opencode_<version>_aarch64.deb from
Releases and install it:
dpkg -i opencode_<version>_aarch64.debdpkg -r opencodeOpenCode is an AI assistant that lives in your terminal. Its normal Linux builds depend
on a system library called glibc, which Android does not have (Android uses a
different library called bionic). Because of that, the normal Linux download crashes in
Termux.
This project adapts OpenCode to run natively:
- Start from the official Android build of Bun (the JavaScript engine OpenCode uses), published by the Bun project.
- Take OpenCode's actual program code and graft ("transplant") it into that Android Bun.
- Swap in an Android-compatible renderer so the full-screen text UI works.
- Package the result as one file you install with
dpkg.
The result behaves like a normal Termux program: opencode just works — no proot, no
extra Linux distribution, no compatibility layer at runtime.
- ✅ The full interactive terminal UI (TUI)
- ✅
opencode run "...",opencode serve, providers, models, and plugins - ✅ No glibc, no proot, no Ubuntu container
- ✅ Easy updates straight from this repository's releases
| Requirement | Why |
|---|---|
| 64-bit (arm64 / aarch64) device | Packages are built for aarch64 |
| Android 9 (API 28) or newer | The native binary needs a recent Android bionic |
| Termux from F-Droid or GitHub | The Play Store version is outdated |
| ~2 GB free space while building | Downloads and temporary build files |
| Problem | What to do |
|---|---|
opencode: command not found right after install |
Reopen Termux, or run hash -r |
| The script says a package is missing | Just run it again; it installs dependencies automatically |
--release says the release was not found |
That version isn't published yet — run without --release to build it locally |
| An old version still starts | Check for duplicates with dpkg -l | grep opencode and remove extras |
| Build fails with no space | Free up storage and re-run; the build needs ~2 GB free |
| A brand-new OpenCode version isn't showing up | Releases are built automatically (daily). To get it immediately, run bash termux-upgrade.sh |
| TUI looks broken or will not start | Make sure you are on Android 9+ with F-Droid/GitHub Termux |
Everything below is about how the build works. If you only want to use OpenCode, you can stop reading here.
official Android Bun (ELF) OpenCode program code (module graph)
\___________________________/
|
tools/transplant/transplant.py (graft)
|
"revive" surgery (fix the embedded size field)
|
swap in an Android build of libopentui.so (TUI renderer)
|
seccomp hardening shim (aarch64)
|
single runnable opencode ELF (~180 MB) -> .deb
Key pieces:
tools/prebuilt/libopentui-bionic.so— the Android build of the TUI renderer.tools/prebuilt/libopencode-crhandler.so— a small aarch64 seccomp shim.tools/transplant/— the graft/revive pipeline (transplant.py,swap_tui.py,revive_patch.py).
make transplant VER=1.18.31 # -> artifacts/transplant/1.18.31/opencode-native-tui
make deb-native VER=1.18.31 # -> packing/dpkg-native/opencode_1.18.31_aarch64.deb
make pacman-native VER=1.18.31The everyday entry point is still just:
./scripts/termux-upgrade.sh.github/workflows/build-native-self.yml runs on a free ubuntu-latest runner (no
self-hosted machine needed):
- Resolves the latest (or requested) OpenCode version.
- Skips if that version is already released.
- Downloads the official Android Bun and the OpenCode package.
- Runs the transplant pipeline, swaps the TUI library, and applies seccomp hardening.
- Builds the
.deband publishes a release taggednative-<version>.
It runs on a daily schedule and can also be started manually:
gh workflow run build-native-self.yml --repo deepsingh132/opencode-termux \
--ref native-android --field version=1.18.31Shell unit tests live in tests/unit/ and run via .github/workflows/tests.yml
(./tests/run.sh).
Note: CI runs on x86 and can only produce the aarch64 package; it cannot run it. Final runtime checks happen on a real device —
make transplantperforms an on-device TUI probe (tui_probe: pass).
scripts/
termux-upgrade.sh one-command build + install (the user script)
package/ .deb / pacman builders
tools/
transplant/ graft + revive + TUI swap pipeline
prebuilt/ version-independent aarch64 binaries (TUI lib, shim)
watcher/ native file-watcher daemon + plugin shim
.github/workflows/
build-native-self.yml automated native build + release
tests.yml shell unit tests
Makefile make transplant / deb-native / pacman-native
Full technical notes: docs/transplant.md,
docs/comparison-runtime-lines.md.
- OpenCode — the app itself.
- Bun — its official Android build is the base.
- Hope2333/opencode-termux — the original transplant/revive pipeline this project builds on.
- OpenTUI — the TUI renderer.
MIT — see LICENSE.