Bun on Termux
Run Bun natively on Android via Termux using a C userland exec wrapper + LD_PRELOAD shim. No proot, no chroot, no root.
What it handles
Zero-Config Installs
Wrapper auto-injects --cwd and --backend=copyfile. Shim intercepts link/linkat for automatic hardlink-to-copy fallback on Android f2fs.
14KB Compiled Binaries
bun build --compile output embeds the 14KB wrapper, not the 100MB runtime. Runs on any Termux + glibc-runner device.
Deep Shim Coverage
Intercepts openat, stat, access, execve, and link at the glibc level. Spoofs /proc/stat for os.cpus(), translates shebangs automatically.
80 Tests, 18 Categories
CLI, file exec, eval, REPL, test runner, build, package management, scripts, bunx, create, APIs, env vars, network, workers, FFI, and more.
Quick Start
Requires Termux (F-Droid/GitHub), termux-pacman, glibc-runner, and clang on an ARM64 device.
git clone https://github.com/tribixbite/bun-on-termux.git
cd bun-on-termux
make install
chmod +x setup.sh && ./setup.sh
bun --versionCompared to alternatives
Three projects solve the same problem. Different tradeoffs.
| bun-on-termux | bun-termux | bun-termux-loader | |
|---|---|---|---|
| Approach | Bash + C wrapper + shim | C wrapper + shim | Embedded binary + shim |
| Shim syscalls | openat, stat, access, execve, link | openat, execve | dlopen |
| Hardlink fallback | Auto (shim copy) | Manual flag | Manual flag |
| bun install | Auto --cwd + --backend | Manual flags | N/A |
| bun init / create | Works | Manual workarounds | N/A |
| Compiled size | ~14KB | ~100MB | ~92MB |
| Test suite | 80 tests, 18 categories | 8 tests | None |