How do I install XMRig in Termux?
You can install XMRig in Termux by building it from source, then connecting it to a Monero mining pool. This runs the miner directly on your Android device—not in your browser—and works best on a phone or tablet with a 64-bit Android system.
1. Set up Termux and check your device
Install Termux from its official F-Droid listing or official GitHub releases. Avoid random “Termux miner” APKs: they may contain altered software or send your mining rewards to someone else.
Only mine on a device you own or have clear permission to use. Android mining usually produces very little income and can cause heat, battery wear, and slow performance.
Open Termux and run:
pkg update && pkg upgrade
uname -m
If asked whether to continue, enter y.
An output of aarch64 means Termux is running in a 64-bit ARM environment, which is the usual suitable setup for Android phones. If you see armv7l or another 32-bit result, these instructions may not work. A phone can have a 64-bit processor while running a 32-bit Android system.
2. Install the tools and build XMRig
Install the tools needed to turn XMRig’s source code into a working program:
pkg install git cmake make clang libuv openssl
Download the official source and build it:
cd ~
git clone https://github.com/xmrig/xmrig.git
cd xmrig
mkdir -p build
cd build
cmake .. -DWITH_HWLOC=OFF -DWITH_OPENCL=OFF -DWITH_CUDA=OFF
make -j2
These settings disable hardware-detection and graphics-card features that are unnecessary for this Termux setup. The -j2 option limits compilation to two jobs, reducing memory pressure.
Building may take several minutes. Once it finishes, check the result:
./xmrig --version
You do not need root access for this basic setup. Rooting your phone just to mine adds security risks without making phone mining reliably profitable.
3. Connect to a Monero pool
You need your own Monero wallet address and a mining pool that accepts XMRig connections. A pool combines miners’ work and distributes rewards according to its rules.
From ~/xmrig/build, start with:
./xmrig -o POOL_HOST:PORT -u YOUR_XMR_WALLET_ADDRESS -p android -a rx/0 -t 1
Replace the uppercase placeholders with the pool’s server, port, and your public receiving address. Never enter your wallet’s recovery words or private keys.
-a rx/0selects Monero’s RandomX mining algorithm.-t 1starts with one processor thread to limit heat.-p androidsupplies a pool password field; follow your pool’s instructions if it requires something different.
If the pool specifies a TLS port—an encrypted connection—add --tls.
Look for accepted shares, meaning the pool accepted your submitted work. Shares are not immediate wallet payments; check the pool’s payout threshold.
4. Handle common problems safely
RandomX’s fast mode needs roughly 2 GB for its dataset alone, plus other memory. Android may close the miner if memory runs low.
- Build fails: Try
make -j1and inspect the first error. - Huge-page warning: Usually expected on unrooted Android; mining can still work.
- Stops in the background: Check Termux’s battery restrictions.
termux-wake-lockcan help keep the CPU awake; release it afterward withtermux-wake-unlock. - Phone gets hot: Stop with
Ctrl+C. Do not leave it mining unattended or covered.
The bottom line
Start with one thread and treat this as an experiment. Check actual accepted shares, pool payout rules, and a live profitability calculator before expecting earnings.
