Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

tbrew

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.

✨ Features

  • 🔄 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, tbrew can 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-runner runs 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-repo on the first run.

📥 Installation

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).

🚀 Usage

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

⚙️ How It Works (Resolution Pipeline)

When you run tbrew install <package>, it follows this strict priority pipeline:

  1. Check Local: Is it already installed in the tbrew Cellar? -> Done.
  2. Check APT: Is it available in Termux's native APT repositories? -> Install natively via pkg.
  3. Check Homebrew Bottles: Is there a pre-compiled binary for arm64_linux or x86_64_linux? -> Download it, patch the rpath, auto-bridge missing system libraries, and run it via glibc-runner.
  4. 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).

📝 Notes

  • 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 --native flag forces source compilation, resulting in a 100% native Bionic-libc binary with zero proot overhead.
  • tbrew automatically prevents bridging core glibc libraries (like libc.so, ld-linux) to avoid conflicts with Android's Bionic libc.

🤝 Contributing

Found a bug or have an idea to improve the build detection logic? Pull requests are welcome!

📜 License

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

About

A hybrid Homebrew/APT package manager for Termux.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages