KeeperFX app icon

KeeperFX is the open-source Dungeon Keeper remake. This is my fork of it that builds and runs natively on Apple Silicon: a real arm64 Mach-O binary, no Rosetta. Dungeon Keeper was a favourite of mine as a kid and I wanted to play it on the Mac I actually use.

It's unofficial and not endorsed by the upstream team, and it's temporary. Native macOS support is being worked on upstream, and once the official project ships an Apple Silicon build this fork has done its job and I'll stop maintaining it. If you just want to play KeeperFX, use the official project.

Nearly all of the game is upstream's work. I've only touched what was needed to get it building and running on arm64. As with my other ports, the work was done with AI (Claude Code) under my direction.

# Get the build

Download Runs on
KeeperFX.app.zip Apple Silicon Macs (arm64)

Drop KeeperFX.app into a folder next to your existing KeeperFX data and the original Dungeon Keeper files, then double-click. The app locates itself on startup and changes working directory to the folder it sits in, so it finds the data next to it. It bundles its own dylibs, so it runs with no Homebrew installed.

It's ad-hoc signed rather than notarized, so on first launch macOS blocks it with "Apple could not verify…". Clear the download flag once with xattr -dr com.apple.quarantine /path/to/KeeperFX.app, or double-click and then use System Settings → Privacy & Security → Open Anyway.

You need the original Dungeon Keeper files, from an old CD or one of the digital editions. I built and tested against Dungeon Keeper Gold from GOG, where the required files ship uncompressed inside the app bundle, so there's no CD image to extract.

# Screenshots

Running on an Apple Silicon Mac from the arm64 build.

The Dungeon Keeper campaign map, a painted world of floating islands with the current level marked
The campaign map
An isometric view of a small dungeon with the dungeon heart chamber lit up, imps working nearby
The first dungeon, zoomed out
A close isometric view of the dungeon heart surrounded by its pillars, with the tutorial text box below
The dungeon heart up close

# How the build works

The macOS build reuses the native Linux build. macos.mk is linux.mk adapted for arm64 and Homebrew.

KeeperFX is fully decompiled and standalone, with no hooks into the original 32-bit DK.exe at fixed addresses. The Linux build compiles with -march=x86-64, so there's no 32-bit lock-in, which matters because macOS has had no 32-bit support since Catalina. SDL2 is the platform layer for video, input, audio and networking, and the renderer is software and surface based, with no OpenGL or DirectX in the hot path.

# What the fork changes

Everything here sits on top of upstream dkfans/keeperfx.

arm64 correctness. Unaligned access caused SIGBUS crashes in the isometric render, the sprite and pixel draw, the computer player's gold scan and the named-field config framework. Several structs were declared inside #pragma pack(1) blocks but never serialised to disk, being runtime helpers full of pointers. On arm64 a statically-initialised packed struct puts those pointers at unaligned offsets and the linker rejects it, so they're left at natural alignment now. x86 behaviour is unchanged.

Safety fixes. Bounds checks on the RNC decompressor and the script command-name lookup, and a guard on the power-hand path against a bad dungeon pointer or an out-of-range creature model.

User data locations. Saves, settings, high scores, netplay config and screenshots now write to the proper per-user location instead of the game folder, so the install can be read-only and replacing the app never touches your saves. Existing saves are migrated once, copied rather than moved. On macOS that's ~/Library/Application Support/KeeperFX, on Linux $XDG_DATA_HOME/keeperfx, on Windows %APPDATA%\KeeperFX. Screenshots go to Application Support rather than ~/Pictures, so taking one doesn't trigger a privacy prompt mid-game. The reasoning is in ADR 0001.

Packaging and CI. tools/make_macos_app.sh bundles the engine's libraries with dylibbundler and ad-hoc signs the result. CI builds and checks the macOS, Windows and Linux builds on every push to master. The macOS download ships an optional starter keeperfx.cfg with a calmer GUI flash rate, 5 against upstream's 1, used only if the game folder has none.

# Windows and Linux

Use the official project. This fork exists for the Apple Silicon build. The Windows and Linux builds still work here and CI checks them, but there's no reason to use this fork over upstream on those platforms.

# Build it yourself

The full write-up is in docs/MACOS_ARM64_PORT.md.

brew install pkg-config sdl2 sdl2_image sdl2_mixer sdl2_net ffmpeg luajit \
    openal-soft libspng minizip miniupnpc libnatpmp zlib curl dylibbundler
./tools/build_macos_deps.sh
make -f macos.mk -j"$(sysctl -n hw.ncpu)"
tools/make_macos_app.sh

GPL v2, same as upstream.

# Tech stack

C C++ arm64 SDL2 Make Homebrew GitHub Actions