On Apple Silicon Macs, KSP runs under Rosetta 2 (x86_64). The Advanced Fly By Wire mod depends on two native libraries that are not automatically available on macOS:
libSDL2-2.0.0— used for joystick/controller inputXInputInterface— the native layer underXInputDotNetPure.dll, a Windows XInput wrapper
Both cause DllNotFoundException spam in the Unity log, and the AFBW config window appears
empty because controller enumeration crashes on every frame.
The symlink approach (dropping dylibs next to the KSP binary) is not sufficient on its own because Unity's embedded Mono resolves native library names through its own dllmap config, not just the filesystem search path.
- Install an x86_64 build of SDL2 via the Rosetta Homebrew prefix at
/usr/local - Build a stub
XInputInterfacedylib (x86_64) that returns "no controller" — this lets Mono load the library successfully so the mod falls through to its SDL2 code path - Register both libraries in Unity's embedded Mono dllmap config so they are found by name
- Homebrew installed for x86_64 (Rosetta) at
/usr/local/bin/brew- If not present, install it:
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- If not present, install it:
- Xcode Command Line Tools (for
clang):xcode-select --install
arch -x86_64 /usr/local/bin/brew install sdl2Verify it is the right architecture:
file /usr/local/lib/libSDL2-2.0.0.dylib
# should say: Mach-O 64-bit dynamically linked shared library x86_64The stub exports XInputGamePadGetState and XInputGamePadSetState — the only two symbols
XInputDotNetPure.dll imports. GetState returns ERROR_DEVICE_NOT_CONNECTED (1167) so
AFBW sees no XInput controllers and falls back to SDL2.
From this directory:
make
make installmake install copies xinputinterface.dylib to:
/Users/mtspaces/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/MacOS/
Edit this file:
/Users/mtspaces/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/MonoBleedingEdge/etc/mono/config
Add the following lines inside the <configuration> block (before the closing tag):
<dllmap dll="XInputInterface" target="/Users/mtspaces/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/MacOS/xinputinterface.dylib" os="osx"/>
<dllmap dll="libSDL2-2.0.0" target="/usr/local/lib/libSDL2-2.0.0.dylib" os="osx"/>
<dllmap dll="SDL2" target="/usr/local/lib/libSDL2-2.0.0.dylib" os="osx"/>- The arm64 SDL2 at
/opt/homebrewwill NOT work — KSP is x86_64 and cannot load arm64 dylibs. - If KSP is updated via Steam it may overwrite the Mono config. Re-apply Step 3 if AFBW breaks again after an update.
- The stub dylib in this repo only needs to be rebuilt if you wipe the KSP install. The
Makefile
installtarget handles placement.