For education purposes only · no game files included · bring your own THUG
Guide 01

Installation

How to build the game from source on macOS, run it against your own THUG1 PC data, and pack a double-clickable app in a disk image.

Goal./build-macos.sh and play. Then ./build_dmg.sh for a THUG.app anyone can drag to Applications.

1Get the tools

Xcode Command Line Tools for clang and flex, Homebrew for cmake and ninja (the script installs those two if they're missing). SDL2, glad, glm, miniaudio and the QScript compiler are vendored and built from source.

shellterminal

2Build

One script: configures CMake with Ninja, builds the game and the script compiler, compiles Scripts/*.q into Game/Data/scripts/, and clones your ../Data into Game/Data.

shellterminal

The data copy is cp -c, an APFS clone. Gigabytes of skate park, zero bytes of disk. Apple got one right.

excerptbuild-macos.sh
First boot: the main menu, with keyboard hints because the keyboard was the last thing touched.
First boot: the main menu, with keyboard hints because the keyboard was the last thing touched.

3Let the build output go somewhere else

The DMG build is a universal (arm64 + x86_64) Release in its own folder, so the executable's output directory became a cache variable instead of a hardcoded Game/.

diffCMakeLists.txt · 97790b7

4Teach the game it lives in an app bundle

Inside THUG.app/Contents/MacOS/THUG the data sits in Contents/Resources/Data. Detect the bundle by its folder names and point the data path there.

diffWn32/Code/Plat/Sys/File/p_filesys.cpp · 97790b7

Writable things (saves, config.ini, soundtracks) can't go in the bundle: see How save works.

5Pack the disk image

shellterminal

The script builds the app (icons from icon.png), draws the window background with macos/dmg_art.swift, and lays out the Finder window (app on the left, an Applications link on the right) by scripting Finder, which is why the first run asks for permission to control it.

If Finder asks whether Terminal may control it: yes. It's moving two icons, not your bank account.