Android ARM64 (Termux): launcher resolves linux-arm64 binary but npm rejects optional dependency (EBADPLATFORM)
What version of Codex CLI is running?
0.146.1
What subscription do you have?
ChatGPT Plus
Which model were you using?
N/A (CLI does not start)
What platform is your computer?
Android arm64 $ uname -mprs aarch64 aarch64 Android
What terminal emulator and version are you using (if applicable)?
Termux Node.js 26.3.1 npm 12.0.2
Codex doctor report
Not available.
The CLI exits before it can execute any commands due to a missing optional dependency.
What issue are you seeing?
Installing Codex succeeds:
npm install -g @openai/codex@latest
However, running:
codex
fails with:
Error: Missing optional dependency @openai/codex-linux-arm64.
Reinstall Codex: npm install -g @openai/codex@latest
I investigated further.
Node reports:
node -p "process.platform"
android
node -p "process.arch"
arm64
The launcher contains an explicit Android platform case:
case "android":
and maps Android to the target triple:
aarch64-unknown-linux-musl
which resolves to the package:
@openai/codex-linux-arm64
However, that optional dependency is never installed.
What steps can reproduce the bug?
- Install Termux on Android (arm64).
- Install Node.js and npm.
- Run:
npm install -g @openai/codex@latest
- Execute:
codex
The CLI exits immediately with:
Missing optional dependency @openai/codex-linux-arm64
Further investigation shows:
npm install -g npm:@openai/codex@0.146.1-linux-arm64
fails with:
EBADPLATFORM
wanted:
os: linux
cpu: arm64
current:
os: android
cpu: arm64
What is the expected behavior?
Either:
- Android/Termux is supported, in which case the required platform package should be installable and the CLI should launch successfully.
or
- Android/Termux is intentionally unsupported, in which case the installer or launcher should provide a clear "unsupported platform" message instead of reporting a missing optional dependency.
Additional information
The launcher appears to recognize Android:
case "android":
and maps it to the Linux ARM64 target.
However, npm refuses to install the corresponding optional dependency because it is published with:
os: linux
cpu: arm64
while Node on Termux reports:
process.platform = "android"
process.arch = "arm64"
This appears to create a mismatch where the launcher expects the Linux ARM64 package but npm never installs it due to platform metadata.
I'm not certain whether Android/Termux is intended to be supported, but the current behavior seems inconsistent because the launcher explicitly handles the Android platform while the dependency metadata prevents the required binary from being installed.
1 Comment
Adding full root cause analysis and a working solution for anyone trying to run the CLI on Android / Termux.
Beyond the initial
EBADPLATFORMissue duringnpm install, there are two subsequent runtime failures when executing theaarch64-unknown-linux-muslbinary on Android:---
1. Root Causes on Android / Termux
EBADPLATFORM):bin/codex.jsalready explicitly handlesprocess.platform === "android"and maps it toaarch64-unknown-linux-musl, but the@openai/codex-linux-arm64npm package only lists"os": ["linux"], causing npm to skip/reject installing the optional binary dependency on Termux whereprocess.platform === "android".failed to lookup address information: Try again/EAI_AGAIN):Musl libc's resolver strictly expects DNS nameservers at
/etc/resolv.conf. On Android,/etc/resolv.confdoes not exist (Termux stores it at$PREFIX/etc/resolv.conf). This causes all domain lookups (chatgpt.com) to fail.invalid peer certificate: UnknownIssuer):rustlsattempts to load root CA certificates from standard Linux paths (/etc/ssl/certs/ca-certificates.crt,/etc/ssl/cert.pem,/etc/pki/tls/certs/ca-bundle.crt). These paths do not exist in Android's userland (Termux stores the CA bundle at$PREFIX/etc/tls/cert.pem).---
2. Working Fix in
bin/codex.jsWe can make the global npm package work out-of-the-box on Termux by updating the launcher wrapper in
bin/codex.js:SSL_CERT_FILE,SSL_CERT_DIR, andCARGO_HTTP_CAINFOpointing to$PREFIX/etc/tls/cert.pem.prootto bind$PREFIX/etc/resolv.confand$PREFIX/etc/tls/cert.peminto standard Linux locations when/etc/resolv.confis missing:---
3. Verification (
codex doctor)With this wrapper in place:
HTTP 101 Switching Protocols) towss://chatgpt.com/backend-api/...