Install Antigravity CLI (agy) on Termux – Step-by-Step Fix

I ran the official install script. It downloaded. It started. And then—boom. Nothing. Just a cryptic "TLS segment underaligned" error and a silent crash. I was trying to get Google's Antigravity CLI (agy) running on my Android tablet, and Android's unique system libraries were rejecting the binary outright. Standard Linux expects one thing; Android's Bionic libc delivers another. I needed a bridge.

After some trial and error (and one completely broken Termux session), I landed on a clean, repeatable method: a lightweight Debian container inside Termux using proot-distro. No root access required. No manual binary patching. Just a stable, isolated Linux environment where agy runs as if it were on a cloud server. And a tiny wrapper script that makes the whole thing invisible—you type agy in Termux, and it just works.

In this guide, I'll walk you through every single command I ran, in the exact order, with explanations so you understand why each step exists. By the end, you'll have Antigravity CLI running on your phone or tablet, fully integrated with your normal workflow.

The Problem: Why agy Crashes on Android

When you try to run a standard Linux binary on Android, you hit a fundamental incompatibility: Android uses Bionic libc, not glibc. One specific manifestation is the TLS (Thread Local Storage) alignment mismatch. Standard Linux expects TLS segments aligned to 64 bytes; Android uses 32. The result? The binary attempts to allocate memory in a way Android's linker rejects, and it crashes before it even starts.

There are two ways around this: manually patch the binary (fragile, breaks on updates) or provide a genuine glibc environment. We're doing the second one.

The Solution: A Debian Container Inside Termux

proot-distro is a Termux utility that lets you run full Linux distributions—Debian, Ubuntu, Fedora—in a userspace chroot. It doesn't need root, it doesn't touch your Android system partition, and it provides real glibc. Anything you install inside the container behaves exactly as it would on a standard Linux server.

Here's the complete, step-by-step process.

Step 1: Install proot-distro

Open Termux and update your packages, then install proot-distro:

pkg update && pkg upgrade
pkg install proot-distro -y

This gives you the ability to create and manage Linux containers.

Step 2: Install a Debian Container

Now pull down a minimal Debian image. I used Debian 13 (Trixie), which is the current stable release as of 2026:

proot-distro install debian

The download is roughly 80–100 MB. Once it finishes, you can test the container by logging in:

proot-distro login debian

You'll see the prompt change to root@localhost. Type exit to return to Termux.

Step 3: Install agy Inside the Debian Container

Now the key step. We log into Debian and run the official Antigravity CLI installer. I combined the update, curl install, and agy install into a single command so you don't have to sit and wait between steps:

proot-distro login debian -- bash -c "apt update && apt install curl -y && curl -fsSL https://antigravity.google/cli/install.sh | bash"

Let that run. It will install curl, download the agy binary, and place it in /root/.local/bin/agy inside the container. Once the prompt returns, verify the installation worked from within the container:

proot-distro login debian -- /root/.local/bin/agy --version

If you see a version number, the binary is healthy and running on glibc.

Step 4: Create a Local bin Directory

We want to run agy directly from Termux without typing proot-distro login debian every time. To do that, we create a personal bin folder in your Termux home:

mkdir -p ~/bin

This directory will hold our wrapper script.

Step 5: Create the Wrapper Script

The wrapper script is a tiny bash file that does three things: launches the Debian container, passes your current working directory so agy can see your files, and forwards any arguments you type.

cat << 'EOF' > ~/bin/agy
#!/data/data/com.termux/files/usr/bin/bash
proot-distro login debian -w "$(pwd)" -- /root/.local/bin/agy "$@"
EOF

Let me explain each part:

  • -w "$(pwd)": Sets the working directory inside the container to whatever folder you're currently in. If you're in ~/projects/myapp, agy will see those files.
  • -- /root/.local/bin/agy: The full path to the agy binary inside Debian.
  • "$@": Passes through any extra arguments (like --help, a prompt, or a subcommand).

Step 6: Make the Script Executable

chmod +x ~/bin/agy

Step 7: Add ~/bin to Your System PATH

Termux needs to know where to find the agy command. Add ~/bin to your PATH:

# Make it available right now
export PATH="$HOME/bin:$PATH"

# Make it permanent (survives closing and reopening Termux)
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc

Step 8: Verify Everything Works

Close and reopen Termux (or just run source ~/.bashrc). Then test the command:

agy --version

If you see a version number, you're done. Try a real prompt:

agy "Explain what a TLS segment is in 2 sentences"

The response should appear directly in your terminal.

Why This Method Is Better Than Binary Patching

  • Updates work automatically: When Google releases a new agy version, you run the installer inside Debian again. No manual hex edits.
  • Dependencies are handled: SSL certificates, networking libraries, and glibc all live inside the Debian container, exactly as Google expects.
  • Isolation: If agy ever misbehaves, it's contained. Your Termux environment stays clean.
  • No root: Everything runs in userspace. You don't need a rooted Android device.

Troubleshooting Common Issues

"proot-distro: command not found"

Run pkg install proot-distro again. If it still fails, ensure you installed Termux from F‑Droid, not the Play Store. The Play Store version is outdated and missing packages.

"Permission denied" when running agy

Check that the wrapper script is executable: ls -la ~/bin/agy. If it doesn't show x permissions, run chmod +x ~/bin/agy again.

agy can't see my files

The -w "$(pwd)" flag in the wrapper passes your current directory. Make sure you're in the correct folder when you run agy. The container sees exactly that folder and its contents.

Debian container takes too much storage

A minimal Debian install with agy uses about 400–500 MB. If you're low on space, you can remove the container with proot-distro remove debian and reinstall only when needed, but you'll lose the agy binary each time.

Frequently Asked Questions

Do I need root access on my Android device?

No. proot-distro works entirely in userspace. It uses ptrace to emulate a chroot, which does not require root on modern Android kernels.

Does this work on all Android phones?

Any device running Android 7.0 or later with an ARM64 processor (which includes virtually all phones from 2017 onward) should work. The Termux app must be installed from F‑Droid for full package availability.

How do I update agy to the latest version?

Simply re-run the install command inside Debian:

proot-distro login debian -- bash -c "curl -fsSL https://antigravity.google/cli/install.sh | bash"

Can I use this method for other Linux CLI tools?

Yes. Any Linux binary that crashes on Android due to glibc/Bionic incompatibility can be run this way. Install it inside the Debian container and add a wrapper script. The pattern is identical.

Is this slower than running a native Termux binary?

Slightly. There is a small overhead from the proot syscall translation. For a CLI tool that primarily makes network requests (like agy), the difference is negligible. You won't notice it.


Over to You

Did the "TLS segment underaligned" error drive you crazy too? Now you have a permanent fix that works for agy and any other Linux binary that refuses to run on Android. If you try this and hit a wall, or if you've found an even cleaner method, drop a comment. I read every single one.

Share this with someone who said "you can't run real dev tools on a phone." They're wrong. You just proved it.

Comments