Skip to content

feat: add Android/Termux support to postinstall and wrapper#1144

Open
Ue1i7on wants to merge 1 commit into
XiaomiMiMo:mainfrom
Ue1i7on:fix/android-termux-support
Open

feat: add Android/Termux support to postinstall and wrapper#1144
Ue1i7on wants to merge 1 commit into
XiaomiMiMo:mainfrom
Ue1i7on:fix/android-termux-support

Conversation

@Ue1i7on

@Ue1i7on Ue1i7on commented Jun 19, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #1139, #305

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

On Termux (Android arm64), os.platform() returns "android". The platformMap in both postinstall.mjs and bin/mimo only mapped darwin, linux, and win32. This caused:

  1. postinstall.mjs constructs @mimo-ai/mimocode-android-arm64 — a package that doesn't exist. The correct binary is @mimo-ai/mimocode-linux-arm64.
  2. bin/mimo fails at runtime with the same wrong lookup, and spawn() tries to execute the glibc-linked binary directly. On Termux, the linux-arm64 binary is compiled against glibc and can't run natively (Termux uses Android's bionic libc).

Changes:

  • postinstall.mjs: add android: "linux" to platformMap so the postinstall resolves the correct binary package.
  • bin/mimo: add android: "linux" to platformMap; in the run() function, detect Android and use grun (glibc-runner) as the command wrapper, passing the target binary as the first argument.

Why this works: Termux provides grun (via the glibc-runner package from tur-repo) which loads a full glibc userspace and executes glibc-linked binaries. The linux-arm64 binary can run under grun, and the platform mapping fix ensures the correct package (@mimo-ai/mimocode-linux-arm64) is looked up.

How did you verify your code works?

Tested on Termux (Android 16, aarch64) with Node v24 and npm v11:

  • Installed @mimo-ai/cli@0.1.1 with --ignore-scripts
  • Installed @mimo-ai/mimocode-linux-arm64@0.1.1
  • Ran postinstall.mjs manually to verify binary is correctly resolved and linked
  • Ran mimo --version — outputs 0.1.1
  • Ran mimo --help — full help output with commands, options, and agent listing
  • Database migration ran successfully on first launch

The --force flag is still needed on Termux to bypass the os constraint on optional dependency packages. The generated package.json for binary packages only lists "os": ["linux"], so npm filters them out on Android. Fixing that in the build script is a separate concern.

Screenshots / recordings

Screenshot 1 -  VersionHelpStart

Screenshot 2 - HomeScreen

Screenshot 3 - Running

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

On Termux (Android), os.platform() returns 'android', which caused:
- postinstall.mjs to look for @mimo-ai/mimocode-android-arm64 (doesn't exist)
- bin/mimo wrapper to construct an incorrect lookup path

Changes:
- postinstall.mjs: map android to linux for binary package lookup
- bin/mimo: add android to platformMap for correct binary resolution
- bin/mimo: use grun (glibc-runner) on Android to execute glibc-linked binary

Linux arm64 binaries are compiled against glibc and need grun to run
on Termux, which uses Android's bionic libc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error installing @mimo-ai/cli on Termux (Android arm64)

1 participant