run.sh: pass both DYLD vars through arch, and make ARCHPREFERENCE a setting - #118
Merged
Merged
Conversation
…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
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.
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
approved these changes
Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@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.