How do I run XMRig in the background?
You can run XMRig in the background by starting it in a separate window, detaching it from your terminal, or setting it up as an operating-system service. The simplest choice is a minimized window on Windows, or nohup on Linux and macOS. Background mining still uses your processor, so it can affect heat, power use, and how responsive your computer feels.
Before you put it in the background
XMRig is a standalone mining program, not a browser miner. Closing your browser does not stop it.
First, run XMRig normally and check that your configuration works. Your config.json file should contain your mining pool’s address and your wallet address. A pool combines miners’ work and shares rewards.
Look for accepted shares in XMRig’s output. These are pieces of mining work your pool has accepted. Fix connection or configuration errors before making the program less visible.
Only run it on a device you own or have clear permission to use. Background operation should never mean hiding mining from the device’s owner.
On Windows: start a minimized window
Open PowerShell in your XMRig folder and run:
Start-Process -FilePath ".\xmrig.exe" `
-ArgumentList "--config=config.json --log-file=xmrig.log" `
-WorkingDirectory (Get-Location).Path `
-WindowStyle Minimized
This starts XMRig separately, with its window minimized. You can close the PowerShell window you used to launch it without stopping that separate XMRig process.
To check or stop it:
- Restore the XMRig window to see its output.
- Open
xmrig.logto review recorded activity. - Press Ctrl+C inside the XMRig window to stop mining.
- If that does not work, use Task Manager to end
xmrig.exe.
This method does not keep mining through a Windows sign-out or restart. For automatic startup, you can use Task Scheduler with an explicit working folder and your configuration-file path. Keep the task clearly named so you can find and disable it.
On Linux or macOS: detach it from your terminal
Open a terminal in your XMRig folder, then run:
nohup ./xmrig --config=./config.json > xmrig.log 2>&1 &
echo $! > xmrig.pid
Here is what those parts do:
nohuplets the program survive closing the terminal.> xmrig.log 2>&1sends output and errors to a log file.&puts the command in the background.- The second line saves its process ID—the number identifying that running program.
Watch its output with:
tail -f xmrig.log
Pressing Ctrl+C here stops watching the log, not mining.
To stop XMRig, run this from the same folder:
kill "$(cat xmrig.pid)"
Use that saved ID for the current mining session only. After a restart, process IDs can be reused.
Know what background mode does not do
Background mode does not reduce mining’s processor usage. Adjust XMRig’s CPU settings separately if your computer becomes slow or hot.
It also does not keep your computer awake. Sleep pauses mining, and shutdown stops it.
For reliable startup after reboot, use an operating-system service: typically systemd on Linux or launchd on macOS. These can manage restarts and logs. Avoid launching a second copy while one is already running.
The bottom line
Start with a minimized window or nohup. Keep a log, know how to stop XMRig, and check heat and responsiveness before leaving it running unattended.
