Skip to content

run.sh: pass both DYLD vars through arch, and make ARCHPREFERENCE a setting - #118

Merged
ManlyMarco merged 3 commits into
NeighTools:masterfrom
dobbo-ca:archpreference-knob-8b21
Sep 24, 2026
Merged

ManlyMarco merged 3 commits into
NeighTools:masterfrom
dobbo-ca:archpreference-knob-8b21

Conversation

@cdobbyn

@cdobbyn cdobbyn commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

@arrowmaster's asks from the Discord thread on #104. arch drops DYLD_LIBRARY_PATH the same as DYLD_INSERT_LIBRARIES but it was never passed back; ARCHPREFERENCE needs to be settable for loaders whose native deps have no arm64 build; and every macOS launch goes through arch now, since arch picks the first architecture the executable actually has, so an x86_64-only game still starts under Rosetta. LD_* stays on Linux, DYLD_* stays on macOS.

Tested on Valheim, BepInEx 5.4.23.5, macOS 26.6, M-series, with both the arm64 and the x86_64 preference. Not run on Intel. Closes #107.

…etting

arch is a platform binary, so dyld drops DYLD_LIBRARY_PATH along with
DYLD_INSERT_LIBRARIES. Only the latter was passed back with -e, so the game
resolved libdoorstop.dylib by cwd alone and failed to start whenever it was
launched from anywhere but the game directory.

ARCHPREFERENCE was a constant in the middle of the script. Games and loaders
whose native dependencies have no arm64 build need a different value, so move
it next to executable_name with the other settings.
@cdobbyn
cdobbyn marked this pull request as ready for review September 23, 2026 02:43
The Apple Silicon branch was the only caller of arch, but the reason it
exists is not Apple Silicon specific: a universal executable runs as x86_64
whenever its parent does, and the parent is out of our hands when Steam or a
launcher starts the script. arch runs the game as the first architecture in
ARCHPREFERENCE the executable actually has, so an x86_64-only game still
starts under Rosetta.

Dropping the branch also lets the LD_* variables stay on Linux and the DYLD_*
variables stay on macOS, and the DYLD_* pair no longer needs to enter this
script's environment at all.
@arrowmaster

arrowmaster commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Looks good to me.

This almost exactly what I wanted to do but didn't have a Mac to test on. Thank you.

@ManlyMarco
ManlyMarco merged commit e8399e2 into NeighTools:master Sep 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS/Apple Silicon: run.sh kills itself — DYLD_INSERT_LIBRARIES leaks into the arm64e arch helper

3 participants