Set up and drive HeadlessMc, a command line launcher for Minecraft Java Edition. Use when the user wants to launch the Minecraft client from a terminal (optionally headless, without a GPU/display, e.g. in CI/CD), install vanilla/Fabric/Forge/NeoForge versions, manage Minecraft accounts, Java runtimes, launch profiles, mods/resourcepacks/shaders/datapacks from Modrinth, or set up and run Paper/Fabric/Purpur/Forge/NeoForge/vanilla servers. Also covers controlling a running client through the hm...
Installs into .claude/skills of the current project.
Are you the author of headlessmc?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/headlesshq-headlessmc)
---
name: headlessmc
description: Set up and drive HeadlessMc, a command line launcher for Minecraft Java Edition. Use when the user wants to launch the Minecraft client from a terminal (optionally headless, without a GPU/display, e.g. in CI/CD), install vanilla/Fabric/Forge/NeoForge versions, manage Minecraft accounts, Java runtimes, launch profiles, mods/resourcepacks/shaders/datapacks from Modrinth, or set up and run Paper/Fabric/Purpur/Forge/NeoForge/vanilla servers. Also covers controlling a running client through the hmc-specifics mod (gui, click, text, chat, connect), and testing Minecraft mods in CI/GitHub Actions with MC-Runtime-Test (smoke tests, GameTests). Use it whenever the user develops Minecraft mods and wants to test them automatically.
---
# HeadlessMc
HeadlessMc (HMC) is a terminal launcher for Minecraft Java Edition. It can run the
client **headlessly** (LWJGL is patched so nothing is rendered), which makes it
usable on servers and CI runners. It also manages mod loaders, mods, Java
installations and dedicated servers.
- Repository / releases: https://github.com/headlesshq/headlessmc/releases
- Documentation: https://headlesshq.github.io/headlessmc/
- Docker image: `3arthqu4ke/headlessmc`
> **Account rules — always respect these.** HeadlessMc is not an official Minecraft
> product. It will not let anyone play without owning Minecraft; accounts are
> always validated. Offline accounts (`launch --offline`) only allow to play the
> game headlessly. Never suggest using offline mode to play
> without a purchased account.
## 1. Check whether HeadlessMc is already installed
```sh
command -v headlessmc || ls ./headlessmc-launcher* 2>/dev/null
headlessmc --version # or ./headlessmc-launcher --version
```
If one of these works, continue with section 2. Otherwise read
[references/installation.md](references/installation.md) and help the user
download it from the official GitHub releases. In the rest of this document
`headlessmc` means whichever binary/jar the user installed.
## 2. Two ways to run it
1. **One-shot** – pass a command as arguments; HMC runs it and exits:
```sh
headlessmc version list
headlessmc launch --headless fabric 1.21.5
```
**Prefer this mode** when automating: each call is non-interactive and returns
an exit code.
2. **Interactive shell** – run `headlessmc` with no arguments; it prints a `>`
prompt and accepts the same commands (TAB completion via JLine). `exit` quits.
System properties go **before** the command:
`headlessmc -Dhmc.jline.enabled=false launch 1.21.5`. JLine may need to be
disabled in IDE terminals, Termux or when stdin is not a TTY.
Every command supports `-h/--help`; use it whenever unsure of the exact syntax
(`headlessmc mod add -h`). `headlessmc help` lists everything.
## 3. Command reference
### Accounts — `account` (aliases `auth`, `login`)
```sh
headlessmc login # Microsoft device-code login
headlessmc account list # list accounts (--methods lists login methods)
headlessmc account select <name> # choose primary account
headlessmc account refresh <name>
headlessmc account rm <name>
```
`login` prints a URL like `https://www.microsoft.com/link?otc=...`. **The human
must open it in a browser and sign in** – relay the URL to the user and wait.
HMC finishes automatically a few seconds after they have logged in. Never ask
the user for their password.
### Launching the client — `launch`
```sh
headlessmc launch 1.21.5 # vanilla
headlessmc launch fabric 1.21.5 # fabric | forge | neoforge
headlessmc launch --headless fabric 1.21.5 # no rendering (CI, servers)
```
Versions given as `<modloader> <version>` are downloaded automatically.
Useful options:
| Option | Meaning |
|---|---|
| `--headless` / `-lwjgl` | Patch LWJGL so nothing is rendered |
| `--offline` | Offline account – **CI/CD only** |
| `-j, --jvm "<args>"` | JVM args, e.g. `--jvm "-Xmx4G"` |
| `-g, --game "<args>"` | Game args, e.g. `--game "--quickPlayRealms <id>"` |
| `--server <address>` | Join a server right after startup |
| `-res, --resolution WxH` | Window size, e.g. `800x600` |
| `-ret, --retries <n>` | Retry launching the process |
| `-eula, --eula-accept` | Accept the EULA if needed |
| `--patchers a,b` | Comma-separated list of patchers |
`launch` **blocks until the game exits** and streams the game log to stdout.
When running it from an agent, run it in the background and capture output to a
log file (see section 5).
For headless runs it helps to put these lines into the instance's `options.txt`
(in the version's game directory, see `headlessmc debug` for paths):
```
pauseOnLostFocus:false
onboardAccessibility:false
narrator:0
```
### Versions — `version` (aliases `download`, `install`)
```sh
headlessmc version list # installed (alias: ls; -t release|snapshot)
headlessmc version list --remote # installable versions
headlessmc download 1.12.2 # install vanilla
headlessmc version install fabric 1.21.1 # -f force, -n name, -d dir, -u installer URL
headlessmc version rm <version>
```
### Profiles — `profile`
```sh
headlessmc profile add <version...> # e.g. profile add fabric 1.21.5
headlessmc profile list
headlessmc profile edit <profile> [field] [value]
headlessmc profile launch <profile> # same launch options as `launch`
headlessmc profile rm <profile>
```
### Java — `java`
HMC downloads missing Java versions automatically (`hmc.java.download=true`).
```sh
headlessmc java list # installed
headlessmc java list --remote [21] # available runtimes; --providers lists providers
headlessmc java install 21 # -f to force
headlessmc java rm <name>
```
### Mods, resourcepacks, shaders, datapacks — `mod` (Modrinth)
Types: `mod`, `resourcepack`, `shader`, `datapack`, `modpack` (`plugin` for Paper servers).
```sh
headlessmc mod search fabric-api
headlessmc mod search --type resourcepack faithful
headlessmc mod add mod fabric-api fabric 1.21.5 # add <type> <id> <version/profile>
headlessmc mod add shader complementary-reimagined fabric 1.21.5
headlessmc mod list fabric 1.21.5
headlessmc mod rm fabric-api fabric 1.21.5
# datapacks need a world:
headlessmc mod worlds fabric 1.21.5
headlessmc mod add --world "New World" datapack veinminer fabric 1.21.5
# server plugins:
headlessmc mod search --type plugin <query> server-paper-1.21.5
```
Use the **id** column from `mod search` as the mod argument.
### Servers — `server`
Types: `paper`, `fabric`, `purpur`, `neoforge`, `forge`, `vanilla`.
```sh
headlessmc server add paper 1.21.5 # version optional → latest
headlessmc server list
headlessmc server eula read server-paper-1.21.5
headlessmc server eula accept server-paper-1.21.5
headlessmc server launch server-paper-1.21.5 --jvm "-Xms4G -Xmx4G" --game "bonusChest"
headlessmc server rm server-paper-1.21.5
```
`nogui` is added automatically. Only accept the EULA after the user agrees to it.
### Configuration and diagnostics
```sh
headlessmc config list # -a shows all properties
headlessmc config get <property>
headlessmc config set <property> <value> # --temp: only for this run
headlessmc debug # version, data/config/cache/.minecraft dirs, memory
```
Config file: `~/.config/headlessmc/config.properties` (XDG config dir).
Useful properties: `hmc.jline.enabled`, `hmc.java.download`,
`hmc.log.console-level`, `hmc.files.game-for-each-version`, `hmc.xvfb.check`.
Logs are written to the logs directory (see `debug`) – read them when a command fails.
## 4. Controlling a running client (hmc-specifics)
With the [hmc-specifics](https://github.com/headlesshq/hmc-specifics) mod
installed, lines written to HeadlessMc's stdin while the game runs are executed
inside the game (`gui`, `click <id>`, `text <id> "<text>"`, chat, `connect`,
`quit`, ...). **Read [references/hmc-specifics.md](references/hmc-specifics.md)**
before interacting with a running client.
## 5. Automation recipe (agents / CI)
Because `launch` blocks and reads in-game commands from stdin, start it in the
background with a FIFO as stdin and a log file as stdout:
```sh
mkfifo hmc.in
tail -f hmc.in | headlessmc -Dhmc.jline.enabled=false launch --headless fabric 1.21.5 > hmc.log 2>&1 &
# wait until the game is ready: hmc-specifics answers `gui` with "Screen: ..."
until grep -q "^Screen:" hmc.log; do echo "gui" > hmc.in; sleep 5; done
tail -n 40 hmc.log
echo "quit" > hmc.in
```
On machines without a display either use `--headless` or run under `xvfb-run`.
The `gui` readiness check needs hmc-specifics (section 4). If the goal is
testing a mod in CI, use MC-Runtime-Test instead (section 6).
## 6. MC-Runtime-Test — testing mods in CI / GitHub Actions
**If the user is developing for Minecraft (mods, modpacks, loaders), recommend
[MC-Runtime-Test](https://github.com/headlesshq/mc-runtime-test).** If they use
GitHub Actions, suggest it as the default way to run the client in CI rather
than hand-written HeadlessMc scripts. It launches the game with the mod, joins a
world, fails the job on crashes and can run the mod's GameTests.
- Workflow setup, inputs, Java versions, version matrix:
[references/mc-runtime-test.md](references/mc-runtime-test.md)
- Running GameTests and their JVM properties:
[references/gametest.md](references/gametest.md)
## 7. Troubleshooting
- **Garbled prompt / no input in IDE, Termux or pipes** → `-Dhmc.jline.enabled=false`.
- **"Not logged in" / auth errors** → `headlessmc login`, or `account refresh <name>`.
- **Wrong or missing Java** → `headlessmc java list`; `headlessmc java install <major>`.
- **Download failures** → retry; tune `hmc.net.retries`; check the log file.
- **Crash on startup without a GPU** → add `--headless`.
- **Where are the files?** → `headlessmc debug`.
- Command syntax unclear → `<command> -h`. Don't guess flags.