A hybrid Homebrew/APT package manager for Termux.
tbrew bridges the gap between Termux's native repositories and the vast Homebrew ecosystem, intelligently resolving dependencies, compiling from source when necessary, and seamlessly running pre-compiled Linux binaries via glibc-runner.
- π Hybrid Resolution: Checks Termux APT first for maximum native performance. Falls back to Homebrew if the package isn't available natively.
- ποΈ Native Compilation: If no pre-compiled Homebrew bottle exists for your architecture,
tbrewcan compile the package from source natively (supports C/C++, Rust, Go, and Node.js). - π Dynamic Auto-Bridge: Automatically detects and links missing native Termux libraries to Homebrew binaries, ensuring
glibc-runnerruns them flawlessly. - πͺΆ Lazy Toolchains: Only downloads heavy compilers (clang, rust, golang, etc.) at the exact moment they are needed.
- β‘ Zero-Config: Automatically installs its own dependencies and sets up the
glibc-repoon the first run.
Run the following command in your Termux terminal to download and install tbrew directly into your PATH:
curl -L -o $PREFIX/bin/tbrew https://raw.githubusercontent.com/CVFA1/tbrew/main/tbrew
chmod +x $PREFIX/bin/tbrew(Note: You can also clone this repository and copy the tbrew script to $PREFIX/bin/ manually).
tbrew works exactly like you would expect from a modern package manager.
Usage: tbrew <command> [package] [flags]
Commands:
install <package> Install a package (APT -> Homebrew Bottle -> Source)
install <pkg> --native Force native compilation from source (bypasses glibc-runner)
upgrade Check and upgrade all installed packages
search <term> Search packages in the Homebrew API
info <package> Show details and dependencies of a package
list List all installed packages
uninstall <package> Remove an installed package
bridge Manually rebuild the native library bridge
cleanup Clear the download and API cache
When you run tbrew install <package>, it follows this strict priority pipeline:
- Check Local: Is it already installed in the
tbrewCellar? -> Done. - Check APT: Is it available in Termux's native APT repositories? -> Install natively via
pkg. - Check Homebrew Bottles: Is there a pre-compiled binary for
arm64_linuxorx86_64_linux? -> Download it, patch therpath, auto-bridge missing system libraries, and run it viaglibc-runner. - Compile from Source: No bottle available? -> Prompt the user to compile it natively using Termux's toolchain (Lazy-loading the required compiler: clang, cargo, go, or npm).
- Packages installed via Homebrew bottles run inside a
glibc-runner(proot) environment. While highly compatible, they may have a slight performance overhead compared to native APT packages. - Using the
--nativeflag forces source compilation, resulting in a 100% native Bionic-libc binary with zero proot overhead. tbrewautomatically prevents bridging core glibc libraries (likelibc.so,ld-linux) to avoid conflicts with Android's Bionic libc.
Found a bug or have an idea to improve the build detection logic? Pull requests are welcome!
Apache License 2.0 License. Feel free to use, modify, and distribute, with the sole requirement of giving credit to this project.
Created by CVFA1