[IL2CPP] Preloader assemblies load but produce no config/log/interop on Mac, Apple Silicon under Rosetta
What happened?
On Apple Silicon (M5, macOS 26.5.2), BepInEx 6 IL2CPP appears to initialise partially and then stop silently. No log, no config, no interop, no crash.
Verified working via vmmap on the running game process:
- libdoorstop.dylib is mapped (__TEXT / __DATA / __LINKEDIT), with a Rosetta .aot translation under /private/var/db/oah/
- CoreCLR-related files are loaded/mapped: dotnet/libcoreclr.dylib (5296K __TEXT), dotnet/libclrjit.dylib, System.Private.CoreLib.dll, System.Reflection.Metadata.dll, System.Collections.Immutable.dll
- BepInEx assemblies are mapped into process memory: BepInEx.Unity.IL2CPP.dll, BepInEx.Preloader.Core.dll, BepInEx.Core.dll, MonoMod.Utils.dll, SemanticVersioning.dll
- cwd is the game folder (confirmed via lsof)
- Game entitlements permit injection (codesign -d --entitlements): com.apple.security.cs.allow-dyld-environment-variables = true com.apple.security.cs.disable-library-validation = true com.apple.security.cs.disable-executable-page-protection = true
Not happening:
- No BepInEx/config generated
- No BepInEx/LogOutput.log generated
- No interop assemblies generated
- Plugin never loads
- Game runs normally to main menu
- No crash report in ~/Library/Logs/DiagnosticReports
Additional observations:
- I manually created BepInEx/config/BepInEx.cfg with [Logging.Console] Enabled=true and [Logging.Disk] Enabled=true / LogLevel=All. lsof shows the process does not open BepInEx.cfg during the failing launch.
- COREHOST_TRACE=1 with COREHOST_TRACEFILE produces no output file, even when passed via arch -e. Presumably expected, since Doorstop loads libcoreclr directly rather than through hostfxr.
History (resolved, for context): An earlier attempt with the default relative doorstop_name produced a DYLD SIGABRT crash: "code signature ... not valid for use in process: library load disallowed by system policy". Patching doorstop_name to an absolute path resolved this.
Steps to reproduce
- Apple Silicon Mac (M5), macOS 26.5.2
- Install Dave the Diver (Steam, native macOS build, Unity IL2CPP, Mach-O universal arm64/x86_64)
- Extract BepInEx-Unity.IL2CPP-macos-x64 (be.785 or be.783) into the game root folder
- In run_bepinex.sh, set executable_name="DaveTheDiver.app"
- Set ARCHPREFERENCE="x86_64" (default "arm64,x86_64" fails)
- Patch doorstop_name to an absolute path: "${BASEDIR}/libdoorstop.dylib" (the default relative name triggers a DYLD code-signature SIGABRT)
- Run ./run_bepinex.sh
- Game launches and reaches main menu normally
- Check BepInEx folder: only core/, patchers/, plugins/ exist. No config/, no interop/, no LogOutput.log.
BepInEx Distribution
Bleeding Edge from BepisBuilds
Log outputs
No BepInEx log is generated. That is the bug.
No preloader_<date>.log is generated.
The game's stdout is flooded with a ~7700-line UnityPlayer Mach-O memory map
dump (MEMORY MAP / LC_SEGMENT_64 / BIND_OPCODE...), which contains no BepInEx
output and may be hiding console output.
BepInEx console was enabled via a manually created BepInEx.cfg, but lsof shows
the process never opens that file.
Environment
* OS: macOS 26.5.2 (build 25F84)
* Hardware: MacBook Air, Apple M5 (Apple Silicon)
* BepInEx: 6.0.0-be.785+6abdba47 and 6.0.0-be.783+c58c42d
(Unity.IL2CPP-macos-x64), identical behaviour on both
* Game: Dave the Diver (Steam), Unity IL2CPP
* Game binary: Mach-O universal (x86_64 arm64), il2cpp_data present
* Launched directly via ./run_bepinex.sh, not through Steam
* Process runs under Rosetta (vmmap shows .aot translations under
/private/var/db/oah/ for libdoorstop.dylib and libcoreclr.dylib)
Related failure on a second title (be.788) — later failure point, plus a diagnostic on the suspected mechanism
Confirming this environment class is still broken on be.788 (5b766a3b), with the failure occurring later in initialization than reported above — so the newer build does not resolve it.
Environment
- Apple Silicon Mac, macOS 26.6.2 (25G83)
- Football Manager 26 (Steam) build 26.3.2.2329565, Unity 6000.0.52f1, IL2CPP, universal Mach-O
GameAssembly.dylib - Official
BepInEx-Unity.IL2CPP-macos-x64be.788 artifact; process runs x86_64 under Rosetta - Same two launch workarounds as above are required:
ARCHPREFERENCE=x86_64, absolutedoorstop_name
Diagnostic relevant to both reports
Under Rosetta + Doorstop-loaded CoreCLR, Process.GetCurrentProcess().Modules (used to initialize Il2CppModule in InjectorHelpers.cs) does not see loaded native libraries: a diagnostic plugin inside the process observed only the host executable, with base address and size reported as 0, while vmmap confirmed GameAssembly.dylib was mapped. Any module-name predicate or base-address math over that enumeration fails.
Since the preloader already resolves GameAssemblyPath (and the DllImport resolver uses it), would you consider initializing the interop from that path/handle — or the handle Doorstop already holds — instead of Process.Modules on macOS? I can test a patch build.
Observed behavior on FM26
| Configuration | Result |
|---|---|
| stock be.788, ARM64 launch | doorstop never fires (artifact's native libs are x86_64-only) — silent, matches report above |
| stock be.788, Rosetta launch | [baseline result — fill from stable-profile test] |
stock be.788 + locally patched BepInEx.Unity.IL2CPP.dll / Il2CppInterop.Runtime.dll (delayed main-run-loop dispatch; non-stock — reported only to mark where the failure moves once module enumeration is bypassed) |
chainloader initializes, preloader detour installs, main-run-loop dispatch attempted, no plugin load follows |
No .ips crash report was captured for the third row, so I'm not claiming a native crash signature; a crash repro will preserve the full report and faulting thread.
Happy to provide vmmap/lsof captures for any row.
I believe I have the root cause, and it is not Doorstop injection.
Paths.SetExecutablePath throws DirectoryNotFoundException before BepInEx writes anything. It probes GameRootPath/<ProcessName>_Data and then GameRootPath/Data, but on macOS GameRootPath is four directories above the executable — the install folder — while a Unity macOS player keeps its data inside the bundle, at <App>.app/Contents/Resources/Data. Neither probe can match, so the throw is unconditional on macOS.
The exception lands in preloader_<date>.log beside the executable, inside <App>.app/Contents/MacOS/, rather than in BepInEx/. That is why it looks like nothing happened.
Unity Mono is unaffected because it passes gameDataRelativeToManaged: true and never reaches the probe. IL2CPP has no managed folder and does.
This is architecture-independent — Intel and Apple Silicon fail identically.
#1407 fixes it, along with a second macOS path bug for GameAssembly. With both applied, Kingdom Two Crowns (Unity 6000.0.61f1) reaches Runtime invoke patched.