This repository provides scripts to automate the installation and setup of the official Antigravity CLI (agy) directly within an Android Termux environment.
No Cloud Shell, no full virtual machine, and no rooted custom ROMs required.
This solution is heavily based on the excellent analysis and manual setup guide provided by Brajesh2022. All credit for the VA39 memory patch strategy goes to the original author.
The official Linux ARM64 binary of Antigravity CLI fails to run natively on Termux due to several environmental and architectural incompatibilities between standard Linux and Android's Bionic/Termux environment.
This setup automates the fixes for the following 8 core issues:
- Virtual Address Space (TCMalloc): The binary assumes a 48-bit ARM64 userspace virtual address space. Many Android devices expose only a 39-bit VA layout. The script patches the binary's TCMalloc configuration to use 39 bits (VA39).
- Seccomp Syscall Blocking: Android's security policies block Go's
faccessat2syscall, killing the process withSIGSYS. The script patches the binary to fall back to the older, permittedfaccessat. - Glibc Linker Scripts vs ELF: The binary expects
libc.soto be a shared object. In Termux's glibc layer, it's often a text linker script, causing aninvalid ELF headererror. The script creates a targeted shim to bypass this. - Bionic Preload Pollution: Termux injects an Android Bionic preload library (
libtermux-exec-ld-preload.so) viaLD_PRELOAD, which crashes the glibc-based binary. The wrapper strips this out. - DNS Resolution: Go's DNS resolver fails to locate Termux's custom resolver config. The wrapper binds Termux's
resolv.confinto the expected/etc/location usingprootand forces pure Go DNS resolution. - TLS Certificate Errors: The binary cannot find standard Linux CA certificates. The wrapper explicitly points it to Termux's CA bundle.
- Path Hashing Conflicts: If you previously had aliases or failed wrapper attempts, bash command hashing keeps pointing to the broken instances.
- Missing Dependencies: Termux lacks the
glibcenvironment by default. The script handles the installation of the Termuxglibc-repoand the required loader.
Before running the setup, you must determine if your phone/tablet's CPU is capable of executing the binary.
The official glibc compiled libraries (specifically libpthread) require the CPU to support hardware atomic instructions known as Large System Extensions (LSE). These were introduced in the ARMv8.1-A architecture.
If you are using an older device or a low-end tablet (e.g., standard ARMv8.0-A), executing the binary will result in a SIGILL (Illegal Instruction) crash specifically on the ldaddal instruction. This is a hardware limitation and cannot be fixed by these scripts.
Run the included test script to verify your CPU supports LSE atomics:
./test_lse_support.shIf the script reports SUCCESS, proceed to installation. If it reports FAILURE, this setup will not work on your device.
If your device passed the LSE atomics test, run the automated setup script. This script installs the required Termux packages, downloads the official binary, compiles and runs the Python patcher, sets up the glibc shims, and generates the launch wrapper.
./setup-antigravity.shAfter the script completes successfully, you will launch the CLI using ~/.local/bin/agy-va39.
For convenience, add these functions to your ~/.bashrc or ~/.zshrc:
# Add local bin to path if not present
export PATH="$HOME/.local/bin:$HOME/bin:$PATH"
agy() {
hash -r
agy-va39 "$@"
}
a() {
hash -r
agy-va39 "$@"
}Reload your shell (source ~/.bashrc) and you can now use the agy command natively in Termux!
When a new version of Antigravity CLI is released, you can simply run ./setup-antigravity.sh again. It will fetch the new binary and re-apply the pattern-based VA39 patches.