Forking Termux lets you distribute a customised terminal app under your own package name and branding. Because Termux has hardcoded filesystem paths derived from its package name (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/termux/termux-app/llms.txt
Use this file to discover all available pages before exploring further.
com.termux), forking requires coordinated changes across the app source, the build system, and the bootstrap archive that supplies the initial Linux environment. This page walks through every required change.
Why forking requires more than renaming the package
Termux binaries compiled for the bootstrap are built with$PREFIX (/data/data/com.termux/files/usr) hardcoded at compile time. Dynamic linker paths, shebang lines, and many other binary-level values reference this exact path. If you change the package name to com.example.terminal, the prefix path becomes /data/data/com.example.terminal/files/usr and all pre-built binaries from the official bootstrap will fail to load or execute.
This means forking requires rebuilding the bootstrap zip from source against the new prefix path.
Key constants to update
TheTermuxConstants class is the single source of truth for paths and identifiers used throughout Termux and all its plugins. The javadoc at the top of that file describes exactly which values must change.
The most important fields are:
TERMUX_HOME_DIR_PATH and TERMUX_PREFIX_DIR_PATH are derived from TERMUX_PACKAGE_NAME, updating TERMUX_PACKAGE_NAME automatically propagates the correct paths everywhere in the Java/Kotlin codebase — provided you do not have any hardcoded strings elsewhere.
Full list of required changes
Update TERMUX_PACKAGE_NAME in TermuxConstants.java
Change
TERMUX_PACKAGE_NAME to your fork’s package name. All path constants (TERMUX_HOME_DIR_PATH, TERMUX_PREFIX_DIR_PATH, TERMUX_FILES_DIR_PATH, etc.) are computed from this value and will update automatically.Update applicationId in build.gradle
In Also update the
app/build.gradle, change the applicationId to match:manifestPlaceholders that supply TERMUX_PACKAGE_NAME and *_APP_NAME values to the manifest template.Update strings.xml and shortcut.xml
These XML resource files cannot use dynamic/computed values, so any references to
com.termux must be changed manually in:app/src/main/res/values/strings.xmlapp/src/main/res/xml/shortcut.xmltermux-shared/src/main/res/values/strings.xml
Update sharedUserId in AndroidManifest.xml
The
android:sharedUserId in app/src/main/AndroidManifest.xml is currently set to ${TERMUX_PACKAGE_NAME} via a manifest placeholder. Ensure the placeholder resolves to your new package name. All plugin APKs you fork must use the same sharedUserId to share a UID.Rebuild the bootstrap zip for the new prefix
Clone termux-packages and build bootstrap archives targeting your new prefix path. The full instructions are in the Building Packages wiki and the bootstrap archives section.The compiled prefix path is the main reason you cannot reuse official Termux bootstrap zips in a fork with a different package name.
Patch plugins that have hardcoded com.termux values
Not all plugin apps use
TermuxConstants from the termux-shared library consistently. Check each plugin for hardcoded "com.termux" strings in intents, permissions, and content provider authorities, and replace them with your package name.For guidance on updating plugins to use termux-shared, see Forking and Local Development.The termux-shared library
Thetermux-shared library was introduced in Termux v0.109. It centralises all shared constants (paths, intent actions, permission names, notification IDs) so that the app and every plugin reference a single authoritative source rather than maintaining independent copies of hardcoded strings.
When forking:
- Import
termux-sharedas a local module or via JitPack and modifyTermuxConstantsbefore building. - Ensure all plugin forks depend on your modified copy of
termux-shared, not the upstream version. - Do not submit pull requests to upstream that hardcode values — the Termux project requires all constants to go through
TermuxConstants.
Building bootstrap archives
The bootstrap zip is the minimal package set shipped inside the Termux APK that bootstraps the Linux environment on first launch. It is not the same as packages installed later viaapt/pkg.
To build bootstrap archives for a custom prefix:
Versioning your fork
Follow the semantic versioning 2.0.0 spec in the formatmajor.minor.patch for all versionName values in build.gradle files. The Termux build system validates this format and rejects builds that do not comply.