timkurvers / valheim-macos

Build-your-own Valheim build for macOS
MIT License
273 stars 14 forks source link
macos valheim

Valheim macOS

Stable version Public Test version

Fantastic news 🎉

Official macOS support for Valheim

This project will most likely be archived next week, see https://github.com/timkurvers/valheim-macos/issues/104 for more information.


Background

Valheim originally did not have a macOS port, as pointed out by developer IronMontilyet:

We're looking into the possibilities of porting the game to MacOS, but we don't have a set timeframe for when that will happen. It's fun to see that so many people are hoping for a Mac version!

After reading an article on porting Unity games to different platforms, I started experimenting with building a custom Valheim build for macOS based on the Linux version: collecting the game data, fetching the correct dependencies and stitching it all together.

Happy to report that it actually paid off 🥳

https://user-images.githubusercontent.com/378235/227661255-e07504da-6072-4e8c-b383-6d2df6b4e329.mp4

The footage above has Bloom and SSAO enabled for aesthetics; turn these off for increased performance.

Performance

The build performs surprisingly well, given that Apple deprecated OpenGL four years ago (!).

In addition, running the game on Apple Silicon hardware requires using the Rosetta 2 translation layer, which may incur an additional performance penalty.

Some statistics thanks to the kind community members of r/macgaming:

Hardware Resolution Settings FPS
M1 Max 14" 1440p Medium 50-60fps
M1 Max 14" 1080p Medium / High 60fps
M1 Pro 16" 1440p Low 60fps+
M1 Pro 16" 1080p Low 100fps
M1 Pro 14" 1440p Medium 45-60fps
M1 Air 900p Medium / High 35-50fps
Intel 15" (2017) 800p Low 30-40fps

Here is to hoping that Iron Gate support macOS natively in the future with Apple Silicon and Metal support. 🍻

Disclaimer

The build has been tested in both single / multiplayer and seems to function adequately without any negative effects.

That said, there is an inherent risk to using custom game builds. In particular, Valheim interfaces with Steam, Azure PlayFab cross-play services, and most likely Iron Gate's own services. These services could start treating this custom build as problematic (or the build itself may behave incorrectly) and put your account, characters etc. in jeopardy.

[!WARNING]

Usage of this build script and the resulting macOS build is at your own risk. Official support channels will not be able to help you with any issues.

Building

Prerequisites

Initial build

These steps take between 15 to 30 minutes to complete, depending on network speed and computing power.

  1. Clone this repository: git clone https://github.com/timkurvers/valheim-macos.

  2. Navigate to the cloned repository in your terminal of choice.

  3. Run ./build.sh and follow the instructions.

    If you would rather use the Public Test build, run ./build.sh --beta instead. Read the official Public Test FAQ to learn more.

  4. Once the build script finishes, verify the presence of Valheim.app in the build folder.

  5. If you are in dire need of disk space: the contents of the vendor folder can be safely deleted at this point. Those files are there to make future rebuilds faster, but are not necessary for the app to function once built.

[!IMPORTANT]

Downloading the repository as a zip-file may cause the build to be damaged due to macOS quarantining files that originate from the internet. Clone the repository instead.

Running

  1. Start Steam and log into an account that owns Valheim.
  2. Launch Valheim.app from the build folder.

[!TIP]

If the game exits after the two logo splashscreens: check that Steam is running.

Patching

Future Valheim patches will require updates to the build script and you may not be able to play with an outdated build. Look at the top of this README to see what version of Valheim is currently supported.

[!NOTE]

It may take a day or two before the script is updated to support a recently released patch.

To generate a new build:

  1. Fetch the latest build script using git pull.
  2. Optional: make a backup of the previous build by copying Valheim.app elsewhere.
  3. Run ./build.sh once more.

Known issues

FAQ

Why is there no downloadable build?

To avoid distributing copyrighted game data, the build script is provided as a means for players who own Valheim on Steam to create their own macOS build and play on their preferred hardware.

Additionally, pre-built binaries from untrusted sources could cause havoc if malicious. Having an open-source build-script available for vetting by anyone limits that risk.

How to pass launch arguments?

As the game cannot be launched directly from macOS Steam, launch it manually with the desired arguments:

open build/Valheim.app --args -console

Why is the bundle named unity.IronGate.Valheim-macOS-Custom internally?

This is to avoid any collisions with a potential future macOS version by the official development team.

Where does the Valheim app icon come from?

The icon is the profile image of the official Valheim Twitter account and is property of Iron Gate.

Contributions

Feedback, issues, or pull requests with improvements are more than welcome! 🙏