Releasing Steam Games on Mac Is a Monster Pain

I've spent the past month or so converting Above Earth and Mega Hasan into desktop games. At one point I was going to release the Mac version of these games to the Mac App Store but then I realized nobody really searches for games there. It made much more sense just to focus on Steam since that covers both PC and Mac games and is much more popular platform.

I was surprised how complicated the Steam release process is in general. I kind of want to cover it in a different post but I'm not sure I have the patience to write it all out. As complicated as it to release a PC game, releasing a game for Mac is even harder..

I'm going to describe the issues I ran into and how I solved them. Maybe it'll save someone reading this from going through the pain I experienced.


Issue 1: Can't Deploy App Because Steamcmd Doesn't Run on Catalina

There's a few ways to deploy a depot on Steamworks. One of the simplest ways is to just zip up your game and upload it there. Sounds great right? It could potentially work but in my case it was changing the format of the sym links in my app package and the game would unexplicably freeze up on launch. It took me a long time to figure out what the issue was.

So I decided to try steamcmd but then I was faced with this lovely error.

Bad CPU type in executable

This error happens because steamcmd is 32 bit but Catalina only likes to run 64 bit stuff. So after messing with it a bunch I realized it's probably impossible and I ended up using parallels to spin up a virtual machine of High Sierra. You have to create Steamworks build scripts (thats another story) and then you can run the standard command found in their documentation.

./steamcmd.sh +login "<ACCOUNT>" "<PASSWORD>" +run_app_build ..\scripts\<BUILD SCRIPT NAME>.vdf +quit

It's a pain but thats how I got it to work.


Issue 2: Notarization would cause the app to crash

Little background here. Apple was always a little (okay more than a little) tight letting you run apps from unknown developers. With Catalina it has gotten much much worse. The app wont even open at all and you get nice messages like this:

Damaged App

So the way to deal with this is to notarize your app. Basically you send a zipped up copy of your app to Apple and their server (it's not reviewed by a person) will check it out and make sure it's not malware. After that you're free to distribute your app as you please and people won't get that error telling them to trash your app anymore.

I'm not sure its stricly required to do this with Steam. I think Apple may have relaxed this requirement with Steam apps but I wanted to do it just in case. Also sometimes it's nice to be able to just email someone an app directly..

I originally followed the steps below with an entitlements.plist containing an empty dictionary and and that was notarizing successfully but the game would then crash after opening it through Steam.

To fix this you need to create an entitlements.plist file with a minimum of the entitlements below. You can probably get away copying what I have or create your own using XCode. With these entitlements I could get the app notarized and also have it work properly with Steam.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>com.apple.security.cs.disable-library-validation</key>
	<true/>
	<key>com.apple.security.cs.allow-dyld-environment-variables</key>
	<true/>
</dict>
</plist>

So now that you have that out of the way.

These are the steps to notarize. Open terminal and run these commands.

  1. This gets the process started and attaches entitlements to the app.
    codesign -s "Developer ID Application: <YOUR NAME>" --timestamp --options runtime -f --entitlements entitlements.plist --deep <APP NAME>.app

  2. Now we zip up our app. You gotta do it this way. Don't do it using the GUI.
    /usr/bin/ditto -c -k --keepParent <APP NAME>.app <APPNAME>.zip

  3. Alright now we actually send the app to Apple. This step can take a while. Once they've reviewed it they'll send you an email telling you it's good. This usually takes me 5-10 minutes. Also you need to create an app specific password (Google it). It's not hard don't worry.
    xcrun altool --notarize-app --primary-bundle-id "<BUNDLE ID>" -u "<YOUR EMAIL>" -p "<APP SPECIFIC PASSWORD>" --file <YOURAPP>.zip

  4. Everything went well and we got the email. This is the last step.
    xcrun stapler staple "<YOUR APP>.app"

Now you can take your notarized app and copy it over to your VM. Then you can finally deploy it to Steamworks. Gross huh?

comments powered by Disqus