Skip to content
ブログに戻る
Command-line terminal showing HeadlessMc launcher running Minecraft Java Edition in headless mode

HeadlessMc: Launching Minecraft from the Command Line

ice
ice
@ice
Updated
136 閲覧
TL;DR:HeadlessMc is a command-line launcher for Minecraft Java Edition that runs the game headlessly without a GUI. Built for automation, testing, and CI/CD pipelines, it gives developers precise control over Minecraft launches through terminal commands.
🐙 Open-source Minecraft project

headlesshq/headlessmc

Minecraft on the command line

⭐ 349 stars💻 Java📜 MIT
View on GitHub ↗

Want to run Minecraft without a graphical interface? HeadlessMc is a command-line launcher that strips away the GUI and lets you control Minecraft Java Edition entirely through terminal commands. It's built for automation, testing, and scenarios where you need Minecraft to run invisibly in the background - think automated testing pipelines, server management, or unattended game instances that report data back to your tools.

What This Project Does

HeadlessMc gives you precise, scriptable control over Minecraft Java Edition launches. Instead of clicking through the launcher, managing accounts in a GUI, and hunting through windows, you issue commands. The project wraps around the official Minecraft client and lets you specify exactly which version to run, which mod loader to use (Fabric, Forge, etc.), and whether it should even display a window at all.

The headless part is the magic. Add the `-lwjgl` flag during launch and Minecraft runs without rendering anything to screen. You can still interact with it programmatically, run tests against game logic, verify server connections, or chain it into CI/CD workflows. The project handles client management (downloading versions), server management, mod installation, and account authentication all from the terminal.

It's written in Java and distributed as a single JAR file (or native executables for Linux, Windows, and macOS). Version 2.9.0 is the current stable release, with a full rewrite planned for v3 that'll bring even cleaner command interfaces.


Why You'd Use This

Let's be honest: most players will never need this. You click the launcher, select your version, maybe load a modpack, and hop into a world. Done.

But there are scenarios where HeadlessMc shines. If you're building a Minecraft testing framework, you need a way to spin up game instances programmatically and verify behavior without manual interaction. Modpack developers use it to test whether a collection of mods actually loads without crashes before shipping it to users. Server operators can script server starts and shutdowns. Game content creators have used it to generate screenshots or video frames automatically. DevOps folks integrate it into CI/CD pipelines to catch game-breaking changes early.

It also lets you run Minecraft in environments where a GUI doesn't exist. Running Minecraft on a headless Linux server? This is your tool. Need Minecraft behavior in a Docker container? HeadlessMc was built for exactly this. The project even includes Docker images pre-configured and ready to go.


Getting Started: Installation and First Launch

Installation is refreshingly simple. Head to the GitHub releases page and grab the JAR file (or a native executable if you prefer). You need Java 8 or newer, though the project includes GraalVM native executables if you'd rather skip the Java dependency entirely.

Once you've got the file, fire it up:

bash
java -jar headlessmc-launcher.jar

That command drops you into an interactive shell. Your first move should be authenticating. The project takes account security seriously and won't let you run without a valid Minecraft account. Type `login` and follow the prompts to authenticate with your Microsoft account.

bash
login

The authentication happens through a browser window, so it's safe and uses official Microsoft OAuth. Once that's done, you can launch the game. Look, the command is straightforward:

bash
launch fabric:1.21.4 -lwjgl

That launches Minecraft 1.21.4 with Fabric and runs it headlessly (the `-lwjgl` flag). Without that flag, you get a visible game window you can interact with normally. With it, the game runs invisibly but remains controllable through commands and automation.

If you're on Linux or macOS and downloaded a native executable instead of the JAR, just make it executable and run it directly:

bash
chmod +x headlessmc-launcher-linux-x64./headlessmc-launcher-linux-x64

Key Features That Matter

The real power comes from what you can do once it's running. Here are the features that make this project useful.

Mod loader support: Fabric, Forge, Quilt - HeadlessMc knows how to launch them all. You specify which loader and version you want, and it handles the complexity of downloading, installing, and patching the right files. This is especially valuable in automation because you don't need to manually manage multiple installation profiles.

Client and server management: The tool can handle both launching a client and spinning up servers from the command line. For someone building testing infrastructure, this means you can automate an entire Minecraft test environment without touching the GUI launcher.

HMC-Specifics support: The project includes companion mods (hmc-specifics) that you can drop into your mods folder. These mods are designed to work with HeadlessMc and expose additional functionality for automation and testing. It's a nice touch for developers who need to hook into game behavior.

Multiple installation methods: JAR, native Linux/Windows/Mac executables, Docker images. So this flexibility means you can run HeadlessMc pretty much anywhere. Got a Windows machine? Grab the EXE. Running Ubuntu in the cloud? Use the native Linux binary. Want to containerize everything? Docker images are ready to go.


Things That'll Trip You Up

First gotcha: account validation. The project won't let you use offline or cracked accounts. You need a legitimate Minecraft account tied to a Microsoft account. It's a security feature, and it means you can't just point this at pirated copies of the game. If you don't own Minecraft, you'll need to buy it first.

Second, headless mode works but isn't magic. When you run with `-lwjgl`, the game still needs all the assets and libraries. The first launch downloads everything, which can take a few minutes. Subsequent launches are faster. If you're running this in CI/CD, cache your `.minecraft` directory between builds or you'll waste time re-downloading everything.

Third, the documentation points you to the new docs site, which is solid. But if you're doing something unusual - like writing automation around the launcher - you might find yourself reading the GitHub issues to understand edge cases. The project is active (maintainers release updates regularly and respond to issues), but it's still community-driven, so documentation gaps exist.

One more thing: Java version matters less than it did, but if you're using the JAR, verify you've got a compatible JVM. The native executables bundle everything, so they're simpler for casual use.


When This Isn't the Right Tool

If you just want to play Minecraft, use the official launcher. It's polished, user-friendly, and does everything most players need. HeadlessMc adds complexity in exchange for programmatic control. You only want it when you're building something that needs to automate Minecraft behavior.

For very basic server operations, the vanilla server JAR is simpler. HeadlessMc is overkill if you're just running a straightforward game server and want to manage it through a terminal. Dedicated server hosting panels handle that more elegantly.

And if you're modding and need deep hook points into Minecraft's internals, you might want to look at other frameworks first. HeadlessMc is a launcher, not a full modding API. It's a companion to modding tools, not a replacement.


Building Around It

The real use case emerges when you combine HeadlessMc with other tools. Pair it with your CI framework and you've got automated testing. Connect it to a monitoring system and you get visibility into game state. Run it in Docker and you've got reproducible, containerized Minecraft environments.

If you're managing Minecraft servers or testing mods, tools like the Minecraft Server Status Checker complement HeadlessMc nicely by letting you verify server health independently. And if you're setting up servers, the Server Properties Generator saves time configuring server behavior before you even launch.

The project's roadmap includes v3, which promises to overhaul the command interface using Picocli for better CLI ergonomics. If you're considering this tool, v3 might be worth waiting for if the current interface feels clunky to you. But the 2.9.0 release is stable and works reliably for most use cases today.

Frequently Asked Questions

Does HeadlessMc work with cracked Minecraft accounts?
No. HeadlessMc requires a legitimate Minecraft account tied to a Microsoft account. The tool validates accounts before launching and won't work with offline or pirated copies. Offline mode is only supported for running in CI/CD pipelines where no account validation is needed.
What Minecraft versions does HeadlessMc support?
HeadlessMc supports recent Minecraft Java versions, including 26.1.2 (the latest release as of 2026) and snapshots. It works with various mod loaders like Fabric, Forge, and Quilt, letting you launch different modded versions from the command line.
Can I run HeadlessMc without installing Java?
Yes. The project provides native executables for Linux, Windows, and macOS that bundle Java internally. Download the native binary for your OS instead of the JAR file, and you won't need to install a separate Java runtime.
Is HeadlessMc suitable for running a multiplayer server?
HeadlessMc can launch game clients in testing scenarios, but for hosting a persistent multiplayer server, the vanilla Minecraft server JAR or a hosting provider is more practical. HeadlessMc excels at automation and testing, not production server hosting.
What's the difference between HeadlessMc and the official Minecraft launcher?
The official launcher is GUI-based and designed for interactive play. HeadlessMc is command-line only and designed for automation, testing, and running Minecraft invisibly in scripts or CI/CD pipelines. It trades user-friendliness for programmatic control.