Valheim

Valheim

UMBERIUM Jun 11, 2024 @ 12:06am
 MacOS and Mods (BepInEx)
Hey. Very happy with the official release on macOS
Performance has increased 2-3 times compared to Crossover

Now the main question is how can we use mods with BepInEx?
Does anyone have a clear instruction?
Last edited by UMBERIUM; Jun 11, 2024 @ 12:08am
Originally posted by electricdawn:
Ok, I got it to run... sort of.

WARNING: This is not for the faint of heart! If you're not at least a tiny bit familiar with the terminal, a command line interface and MacOS you should probably not try this. You are on your own here!

This out of the way:
You don't need to mess with Doorstep. You can download the original BepInEx build for MacOS from:
https://github.com/BepInEx/BepInEx/releases

Download the MacOS build. Unpack it, and move all the files inside the folder into your Valheim directory here (for now Steam ONLY):
/Users/YOURUSER/Library/Application Support/Steam/steamapps/common/Valheim
The files/folders needed are the "BepInEx" folder, as well as the files "libdoorstop.dylib" and "run_bepinex.sh".

Inside of the "run_bepinex.sh" script you need to change
# LINUX: name of Unity executable # MACOS: name of the .app directory executable_name=""
to
# LINUX: name of Unity executable # MACOS: name of the .app directory executable_name="valheim.app"

Once you've done that, you have to make some important changes that you might not be willing to make. Depends on how badly you want mods to work. Otherwise none of this will work.

1. Right click on "valheim.app" in the aforementioned location, select "Information" and click the checkbox "Open with Rosetta". I'm translating this on-the-fly from German, so it might be a bit different in English.

This will open Valheim as an Intel-binary and runs it through Rosetta. This means you will lose performance, but probably not that much.

2. Do the same thing with "Terminal.app" inside the "Applications/Utilities" folder. Set it also to open with Rosetta.

Again, depends upon if you need Terminal as a native app or not. I actually tried to make a copy of it, to run that, but Apple is very adamant in not letting you modify core components of their system, even if it's just a simple terminal program.

Thanks, Apple! :steammocking:

3. Run Terminal and cd to the aforementioned location of your "valheim.app". There's probably a simpler solution for this. I'll append this post with it.

4. Type
chmod 755 run_bepinex.sh
and hit Enter. This will make the script executable.

5. Next, type
./run_bepinex.sh
and hit Enter. It should put out a lot of text and start Valheim. This first time will just initialize the folder structure inside the "BepInEx" folder, so you can add your mods to it. You will probably not see anything happening inside of Valheim, so you can just close it.

6. You can now move your plugins from your former BepInEx/plugins folder into the new BepInEx/plugins folder. I would be very careful with that, and first just try "Valheim.DisplayBepInExInfo.dll". This should give you a notification that BepInEx is actually running the next time you start Valheim (step 5).

I've tried it with PlantAnything, and it seemingly worked. No guarantee that this will work with other, more elaborate mods.

Good Luck!
< >
Showing 1-11 of 11 comments
electricdawn Jun 11, 2024 @ 1:29am 
I have tried it, but so far no luck. It may work if we force Valheim to run in Intel mode, as, of course, BepInEx and the mods are all x86 binaries. I will give that a try tonight.
UMBERIUM Jun 11, 2024 @ 2:48am 
But then we might lose current performance?
UMBERIUM Jun 12, 2024 @ 11:20pm 
Originally posted by electricdawn:
I have tried it, but so far no luck. It may work if we force Valheim to run in Intel mode, as, of course, BepInEx and the mods are all x86 binaries. I will give that a try tonight.
So, have you made any progress?
electricdawn Jun 13, 2024 @ 1:08am 
Hey, nope. It's not working. The main problem seems to be that I can't get the game to run in x86 mode! Not sure what I'm doing wrong, but macOS doesn't want me to run this game through Rosetta. At least it seems that way.

Using the BepInEx launch script (after adapting it to macOS) actually works, and it will start the game, but BepInEx itself never gets loaded.

I got mods to work in the Windows version through CrossOver, but that way will not work for macOS. We need to use the Linux script. I probably have to do a dissection on what the script actually does (it doesn't look like it's doing much, but appearances can be deceiving).

I think the main problem is getting Valheim to run in x86 mode.

Edit: I'm not even sure if the Mac version of Unity is mod-enabled. Could be that it is not, as none of the mods would work out of the door anyway. And then the BepInEx team would need to compile their code on a Mac with ARM as the target as well, before we even have a chance to see any mod support coming.

So, I wouldn't place too much hope on mod support working any time soon.
Last edited by electricdawn; Jun 13, 2024 @ 1:26am
UMBERIUM Jun 13, 2024 @ 1:17am 
I'm guessing it's about the macOS version's file structure. It is different from the Windows version - most likely BepInEx is looking for Windows file paths, which is why we get failure
electricdawn Jun 13, 2024 @ 1:27am 
Please remember that BepInEx works both on Linux and Windows. Linux is Unix, as MacOS is Unix. So that is not the issue. The issue is completely different CPU architectures.
electricdawn Jun 13, 2024 @ 2:08am 
Ok, I think I found the issue.

Basically BepInEx relies on Doorstop. Doorstop is a hacked DLL that allows for BepInEx (and in turn other mods) to work.

Without Doorstop working, mods won't work, period.
UMBERIUM Jun 13, 2024 @ 2:30am 
Do we need to wait for an update or a custom version of Doorstop?
Horemvore Jun 13, 2024 @ 2:35am 
NeighTools/UnityDoorstop.Unix on github...

Might or might not help #shrug
Last edited by Horemvore; Jun 13, 2024 @ 2:36am
The author of this thread has indicated that this post answers the original topic.
electricdawn Jun 13, 2024 @ 5:46am 
Ok, I got it to run... sort of.

WARNING: This is not for the faint of heart! If you're not at least a tiny bit familiar with the terminal, a command line interface and MacOS you should probably not try this. You are on your own here!

This out of the way:
You don't need to mess with Doorstep. You can download the original BepInEx build for MacOS from:
https://github.com/BepInEx/BepInEx/releases

Download the MacOS build. Unpack it, and move all the files inside the folder into your Valheim directory here (for now Steam ONLY):
/Users/YOURUSER/Library/Application Support/Steam/steamapps/common/Valheim
The files/folders needed are the "BepInEx" folder, as well as the files "libdoorstop.dylib" and "run_bepinex.sh".

Inside of the "run_bepinex.sh" script you need to change
# LINUX: name of Unity executable # MACOS: name of the .app directory executable_name=""
to
# LINUX: name of Unity executable # MACOS: name of the .app directory executable_name="valheim.app"

Once you've done that, you have to make some important changes that you might not be willing to make. Depends on how badly you want mods to work. Otherwise none of this will work.

1. Right click on "valheim.app" in the aforementioned location, select "Information" and click the checkbox "Open with Rosetta". I'm translating this on-the-fly from German, so it might be a bit different in English.

This will open Valheim as an Intel-binary and runs it through Rosetta. This means you will lose performance, but probably not that much.

2. Do the same thing with "Terminal.app" inside the "Applications/Utilities" folder. Set it also to open with Rosetta.

Again, depends upon if you need Terminal as a native app or not. I actually tried to make a copy of it, to run that, but Apple is very adamant in not letting you modify core components of their system, even if it's just a simple terminal program.

Thanks, Apple! :steammocking:

3. Run Terminal and cd to the aforementioned location of your "valheim.app". There's probably a simpler solution for this. I'll append this post with it.

4. Type
chmod 755 run_bepinex.sh
and hit Enter. This will make the script executable.

5. Next, type
./run_bepinex.sh
and hit Enter. It should put out a lot of text and start Valheim. This first time will just initialize the folder structure inside the "BepInEx" folder, so you can add your mods to it. You will probably not see anything happening inside of Valheim, so you can just close it.

6. You can now move your plugins from your former BepInEx/plugins folder into the new BepInEx/plugins folder. I would be very careful with that, and first just try "Valheim.DisplayBepInExInfo.dll". This should give you a notification that BepInEx is actually running the next time you start Valheim (step 5).

I've tried it with PlantAnything, and it seemingly worked. No guarantee that this will work with other, more elaborate mods.

Good Luck!
Last edited by electricdawn; Jun 13, 2024 @ 5:52am
UMBERIUM Jun 14, 2024 @ 4:01am 
Good job, first of all thank you!

I was able to run Valheim with mods on macOS in Rosetta mode. Here are my experiences:
1. Some mods from my stable build on Crossover why are crashing the main menu here
2. I lost performance from 90 frames to 60 in empty locations, and from 60 to 30 in laden locations, compared to the native version

For now, the current conclusion is that I'd rather play on Crossover - there's more stability and convenience there, but the performance is about the same as Rosetta. But if I want to play Valheim without mods - the native version is my choice!
< >
Showing 1-11 of 11 comments
Per page: 1530 50

Date Posted: Jun 11, 2024 @ 12:06am
Posts: 11