Caution: Ebitengine on FreeBSD is not tested well by the author.

Desktop Environment

Ebitengine requires X Window system and you need to install a window manager like GNOME3. See the official manual. Note that you also need to do pkg install xorg.

Installing Go

Install Go on your machine. Ebitengine requires Go 1.15 or later.

Note that you do NOT need a C compiler for Ebitengine on Windows.

Installing a C compiler

A C compiler is required as Ebitengine uses not only Go but also C.

On the latest macOS, just type clang on your terminal and a dialog would appear if you don't have clang compiler. Follow the instruction to install it.

You might find the following error when executing clang.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

In this case, run xcode-select --install and install commandline tools.

Use your distribution's package manager. For example, Ubuntu can use apt.

apt install gcc

Use pkg.

pkg install clang

Installing dependencies

Debian / Ubuntu

sudo apt install libc6-dev libglu1-mesa-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev libasound2-dev pkg-config


sudo dnf install mesa-libGLU-devel mesa-libGLES-devel libXrandr-devel libXcursor-devel libXinerama-devel libXi-devel libXxf86vm-devel alsa-lib-devel pkg-config


sudo eopkg install libglu-devel libx11-devel libxrandr-devel libxinerama-devel libxcursor-devel libxi-devel libxxf86vm-devel alsa-lib-devel pkg-config


sudo pacman -S mesa libxrandr libxcursor libxinerama libxi pkg-config


sudo apk add alsa-lib-dev libx11-dev libxrandr-dev libxcursor-dev libxinerama-dev libxi-dev mesa-dev pkgconf
pkg install alsa-lib libxcursor libxi libxinerama libxrandr mesa-libs pkgconf

Confirming your environment

You can check whether you have a correct environment by executing an example:

go run -tags=example

Note that -tags=example is needed to execute the examples as the Ebitengine example packages require the build tag.

If you see this window with a rotating Gophers image, congratulations! You have a correct environment to use Ebitengine!

Rotate example

Running a program with Ebitengine

Ebitengine can be used as a usual Go library. Go command automatically installs Ebitengine when your program uses Ebitengine.

First, create your local module.

# Create a directory for your game.
mkdir yourgame
cd yourgame

# Initialize go.mod by `go mod init`.
go mod init

Use URL for your module name like Actually, any module name like is fine as long as you don't plan to share this publicly. You can change the module name anytime later.

Add main.go with this content:

Run go mod tidy to add dependencies to your go.mod:

go mod tidy

Finally, run go run to execute your program.

go run .

You will be able to see a window with a message:

Hello, World!