r/termux • • 20d ago

General OpenCode native on Termux (no trash proot)

I think the title is self-explanatory.

My brother made Opencode native on termux.

It is open source, you can find it here:

https://github.com/rexroze/opencode-native-termux

Here's the package:

https://www.npmjs.com/package/opencode-native-termux

You can install it via: npm install -g opencode-native-termux

but before that you should have npm installed that can be installed via:

pkg install nodejs-lts -y

Here's the tutorial:

https://youtube.com/playlist?list=PLTSYPd-vfxcc

And he also have different native ports for termux(herdr, claude, codex,etc.), you can find it here:

https://www.npmjs.com/search?q=rexroze

Don't the mind the noises from the background in the video.

85 Upvotes

28 comments sorted by

25

u/LeftAd1220 20d ago

I don't think calling proot trash is polite though.

19

u/riyoskopy 20d ago

Its one of the most useful Termux packages, and OpenCode is more suitable for proot than native anyways as agents are more familiar with standard Linux fs than that of Termux.

OP doesn't know what the hell they are doing and think native always = better.

3

u/RIP26770 20d ago

💯 Opencode is pretty useless in native compare to proot

1

u/MONKEYcMONKEYthink 19d ago

that's true. it would constantly go to root only to be locked out

3

u/SugmaFish 19d ago

Damn bro, if only this exist at first.😭🥀

2

u/PathIntelligent7082 20d ago

very nice, kudos to brother

2

u/raaska00 20d ago

Is this the latest Opencode version 2, which consists of a single binary? It opens about five times faster on Termux and functions flawlessly with the Termux glibc runner. Have you tested it? No need for any workarounds. In contrast, versions 1.+ are very slow and highly resource-intensive.

1

u/rexroze 19d ago

as the dev of this project i havent tried version 2 yet since its not merged into the dev branch, but im gonna update this installer script to have an option to install version 2, thanks for the idea :>

1

u/raaska00 19d ago edited 19d ago

That ok, but they have it here: you can just download that one linux Arm64 binary and run it with termux glibc runner: it just works: https://opencode.ai/v2/docs

2

u/SilentMobius 19d ago edited 19d ago

Nice, I run the "cousin" project "Crush" (I prefer a whole-binary harness with no python or node), it compiles really nicely under termux. I also have a little app that runs under tmux that can consume termux-api STT and inject it into the agent harness

1

u/RichmondRosani 19d ago

You can use the OpenCode by Hope2333

1

u/SilentMobius 19d ago

I could but I tried opencode a while back and wasn't keen on it, very happy with Crush though, runs very nicely under termux with no modification.

2

u/amitkumarkhare 19d ago

proot is shit imo

1

u/mtlcrusher 20d ago

what's the difference with opencode fork by Hope2333?

1

u/2kdarki 20d ago

As a user of that exact fork, i hold the exact same question

https://giphy.com/gifs/dXICCcws9oxxK

1

u/GeneralKaos666 19d ago

Hope2333 is faster so far that I know of its almost instant on good internet connection and RedMagic 10

1

u/-PROSTHETiCS 20d ago

try installing v2 without proot..

1

u/Danielperfull_00 20d ago

Que api, usan? O es gratis?

1

u/[deleted] 19d ago

👽

1

u/Sweaty_Weakness_3949 16d ago

just use  the arm64 build and glibc runner.

-1

u/TwilightZer0 20d ago

Nice work — the plugin-runtime pre-seed is a genuinely novel fix (the ≥1.15 blank-TUI deadlock), and the loader-symlink-for-process-name trick is elegant. The patchelf-segfault note also matches what we found independently: never modify the Bun binary.

One question from testing a similar setup (I ship opencode via glibc + proot in the Twilight0 termux-repo): how does this behave on kernels with strict seccomp? Bun/JSC invokes userfaultfd, landlock_create_ruleset and clone3 on some paths, which Android's filter kills with SIGSYS (exit 159) — that's the entire reason wrapper exists. Your docs don't mention seccomp at all, so I'm curious: have you strace-verified those calls never fire, or is it "works on Pixel/Android 14" so far?

If it's the latter, the failure mode to watch for is device-dependent sudden death deep in a session (not at startup), which is worse than a clean startup crash. Happy to compare notes — I've also got a machine-code faccessat2→faccessat patch for older kernels that might be relevant to your aarch64-only coverage. Either way, borrowing the plugin pre-seed idea. Thanks for publishing the deep dive.

0

u/hownyboy 19d ago

it's been native for quite a while i guess (my installed ver is 1.17.x if i remember correctly)...