A small Bash script to optimize Termux on Android devices by removing background restrictions and increasing the maximum process limit. This is useful for developers and power users who want Termux to run reliably in the background without Android killing its processes.
- Connect to an Android device via ADB over Wi-Fi.
- Increase
max_phantom_processesto allow more background processes. - Remove battery optimizations (Doze mode) for Termux.
- Allow Termux to run in the background and use wakelocks.
- Disable idle state for Termux to prevent app suspension.
- Android device with Termux installed.
- ADB installed on your Termux:
yes | pkg install android-tools- Wireless debugging enabled on your Android device.
- If using wireless debugging, make sure your device is paired first:
adb pair <IP:PORT> <CODE>- Clone this repository:
git clone https://github.com/DevCoreXOfficial/fix-termux-limits.git- Change to the cloned directory:
cd fix-termux-limits- Run the script:
bash fix-termux-limits.sh- Enter your device IP and port when prompted (IP:PORT format).
The script will automatically connect to your device via ADB and apply all optimizations.
This script requires ADB access to your device. Make sure you have debugging enabled.
Use with caution: modifying device configuration settings may affect other apps if not used properly.
Tested on Termux and Android 12+, may work on earlier versions.
This project is licensed under the MIT License. See the LICENSE file for details.