Skip to content

macOS Apple Silicon: Valheim starts but BepInEx does not load when Doorstop injection is lost through Rosetta launch #21

Description

@No898

Summary

On Apple Silicon macOS, BepInExPack_Valheim can launch Valheim successfully while BepInEx/Doorstop is never injected. The game reaches the menu and can join a server, but no BepInEx/LogOutput.log is created and no plugins load.

This appears to happen because the macOS start script needs to run Valheim's x86_64 slice through Rosetta, but the DYLD_INSERT_LIBRARIES environment used by Doorstop is not present at the final Valheim process when the architecture switch happens.

I found the related draft PR #20 for broader Valheim Apple Silicon support. This issue is narrower: a current-user failure mode in the packaged Valheim start script and a small workaround that restores Doorstop injection.

Environment

  • Game: Valheim 0.221.12 (network version 36)
  • BepInEx distribution: BepInExPack_Valheim 5.4.2333 from Thunderstore
  • OS: macOS 26.3.1 (25D2128)
  • Hardware: Apple M4, arm64
  • Install path: external Steam library under /Volumes/FitKid/SteamLibrary/steamapps/common/Valheim
  • Launch method: Steam launch options running start_game_bepinex.sh

Reproduction

  1. Install Valheim from Steam on Apple Silicon macOS.
  2. Install BepInExPack_Valheim 5.4.2333.
  3. Configure Steam launch options to run start_game_bepinex.sh.
  4. Launch Valheim from Steam.

Expected behavior

BepInEx preloader and chainloader start, BepInEx/LogOutput.log is created, and plugins under BepInEx/plugins are loaded.

Actual behavior

Valheim starts normally, but BepInEx does not load:

  • BepInEx/LogOutput.log is not created.
  • No plugin load messages appear.
  • Valheim's player log shows the game running as unmodded, for example:
isModded: False

The game itself continues to run, so the failure is easy to miss unless the BepInEx log is checked.

Local diagnosis

The packaged macOS start script switches to Rosetta/x86_64 for Valheim. In the failing case, Valheim launches, but Doorstop is not injected.

When I set DYLD_LIBRARY_PATH and DYLD_INSERT_LIBRARIES inside an x86_64 shell immediately before exec-ing the Valheim executable, BepInEx loads correctly.

Successful log after the workaround:

[Message:   BepInEx] BepInEx 5.4.23.3 - Valheim
[Message:   BepInEx] User is running BepInExPack Valheim version 5.4.2333 from Thunderstore
[Message:   BepInEx] Chainloader started
[Info   :   BepInEx] 11 plugins to load
[Info   :   BepInEx] Loading [Craft From Containers 3.8.2]
[Info   :   BepInEx] Loading [BalrondShipyard 1.6.5]
[Info   :   BepInEx] Loading [NoTreeStump 1.0.3]
[Info   :   BepInEx] Loading [Jotunn 2.29.0]
[Info   :   BepInEx] Loading [Better Wisps 1.0.42]
[Info   :   BepInEx] Loading [ShaderHelperForMac 2.0.0]
[Info   :   BepInEx] Loading [Skills Preview 0.4.2]
[Info   :   BepInEx] Loading [Quick Stack - Store - Sort - Trash - Restock 1.4.13]
[Info   :   BepInEx] Loading [Sailing 1.1.8]
[Info   :   BepInEx] Loading [Display Day & Time in HUD 1.1.2]
[Info   :   BepInEx] Loading [RecyclePlus 1.3.0]
[Message:   BepInEx] Chainloader startup complete

Workaround

For the current Valheim start script, this works locally:

  1. Enter an x86_64 shell with arch -x86_64 /bin/sh -c.
  2. Set DYLD_LIBRARY_PATH and DYLD_INSERT_LIBRARIES inside that shell.
  3. exec the Valheim executable from there.

I am opening a small PR with that workaround scoped to the Valheim start script. It is not intended to replace the broader native Apple Silicon work in #20.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions