Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Nermal

Moderator
Original poster
Staff member
Dec 7, 2002
21,613
5,615
New Zealand
Hi,

I downloaded vkQuake the other day: it's an open-source engine for running the classic game Quake. Unfortunately, it's a bit stupid: by default it looks for the game resources in the same directory as the app itself. This means that I need to put Quake's "ID1" folder in my Applications folder, which feels like clutter to me.

There's a command-line argument you can pass in that makes it look elsewhere. As far as I can tell, there's no simple way to tell MacOS to launch an app with arguments, so I ended up going a little bit hacky with a solution from Stack Overflow:

I put a script in the app bundle's MacOS folder called launch.sh which runs the vkquake executable with the right argument. I did a chmod +x on it, then updated the app's Info.plist to run launch.sh instead of vkquake.

So far, so good. I can double-click on the vkQuake icon and all is well.

Except... some time later (and I haven't yet determined how long it is, although less than two days) if I double-click on vkQuake it'll immediately crash. I'm not in front of my Mac right now but the crash log says something like "SIGKILL: Invalid code signature". I wondered what had triggered this (after all, the binary code itself is unchanged) but I deleted and reinstalled vkQuake again, reapplied launch.sh, and once again all was well. Then a couple of days later I tried to run it and it crashed again.

What is going on here? It would seem that some sort of security feature is getting in the way, but I don't understand why it works for a while in the first place.

I tried re-signing the app ("codesign --force --deep --sign - /Applications/vkQuake.app") but it reported something like "certificate not in keychain". Although just now while writing this I stumbled upon something saying I should do "codesign --remove-signature" first, so I'll need to try that.

This has got a bit long and rambly, but I suppose my question is "What is the 'best' way to pass arguments to an application, without it breaking?".
 
I tried re-signing the app ("codesign --force --deep --sign - /Applications/vkQuake.app") but it reported something like "certificate not in keychain".
An update to this bit specifically: I had missed the lone hyphen when trying it earlier. After doing that, the game now launches without giving the "invalid signature" error.

Now it crashes with "vkCreateGraphicsPipelines failed" but that looks to be beyond the scope of this thread. (Edit: I replaced it with a fresh version and re-signed it without --deep, which might help. Need to wait a day or two and see whether it fails again.)
 
The code signature is for the whole .app bundle, you modified it so the signature is no longer valid. Gatekeeper will verify again the signature every few days, and so it will prevent it from running.
 
Remove the quarantine attribute
Code:
xattr -rd com.apple.quarantine /Applications/vkQuake.app
 
  • Like
Reactions: !!!
Edit: I replaced it with a fresh version and re-signed it without --deep, which might help. Need to wait a day or two and see whether it fails again.
It failed again.

Gatekeeper will verify again the signature every few days, and so it will prevent it from running.
I've disabled Gatekeeper (sudo spctl --master-disable) and it's still blocking it. The specific messages are "Exception Type: EXC_CRASH (SIGKILL (Code Signature Invalid))" and "Termination Reason: CODESIGNING 1 Taskgated Invalid Signature".

Maybe Gatekeeper needs to be disabled before it fails (i.e. if it's already been "gatekept" as bad, does it continue to be flagged as bad?) so I'll go around the whole circle again...

Remove the quarantine attribute
Code:
xattr -rd com.apple.quarantine /Applications/vkQuake.app
That didn't help.

I guess ultimately the best solution would be to compile a new binary that doesn't need all this hackery in the first place. I also noticed that it's plonking a zero-byte "history.txt" file into Applications on launch, so it's cluttering up the directory even when the game files itself aren't in there!
 
Update: After the undocumented code started driving me nuts, I gave up and have just made a vkQuake folder in Applications. Not as pretty as I'd like, but no hacking required.
 
Signature checks are quite complex, so I can't help. But resigning it properly should work, unless something broke in Apple's code. Maybe check how it was signed in the first place, --deep might not be the right solution.
 
According to the manual (man codesign)
"--deep (DEPRECATED for signing as of macOS 13.0) When signing a bundle, specifies that nested code content such as helpers, frameworks, and plug-ins, should be recursively signed in turn."
 
Yeah, I think using --deep resigned another component (moltenvk?) and stopped it from working.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.