Notes on Haxe

John Gabriele


Some incomplete ramblings on Haxe.


Languages comparable to Haxe include Dart, Kotlin, Reason, and Swift.

Getting Started


More info at the Haxe Download for Linux page.

# apt install haxe
# exit
$ haxe -version
$ man haxe
$ man haxelib
$ haxelib setup  # Accept default ~/haxelib dir.
$ haxe  # Shows some help text.

Editor Setup

Geany works out of the box. (The Emacs Haxe mode is pretty old.) See also this list of editors and IDEs.

Hello World

Create a Main.hx file:

class Main {
    public static function main() {
        trace("Hello, World!");

then run it directly using the built-in interpreter:

haxe -main Main --interp

Or, cross-compile the file and run it. For example, using Python:

haxe -main Main -python

Note: Haxe has its own VM called HashLink.

hxml files

Since some haxe build commands may contain enough arguments that can be a pain to type over and over, you can create .hxml files that contain those args. For example, for the above hello world example, create a yo.hxml file containing:

-main Main

then run

haxe yo.hxml


The Haxe online package repo and library management tool is haxelib (see the haxelib docs). The haxelib command comes with the Haxe Debian software package when you apt install it.

Packages/projects you install via haxelib are often named lowercase with hyphens if necessary. The package files themselves are .zip files, and its haxelib.json file is the package config file.

Haxelib installs and unpacks packages into ~/haxelib. This is your haxelib installed-packages repo. Haxelib can also do project-specific repos.

Language Basics