'How to add launch options to an .arm64 executable without using the terminal on MacOS
I would like to know if someone know how to launch an .arm64 executable with a launch option (in this case "+set fs_game ...") without using a terminal ? I know that you can do that in windows configuring the .exe but I don't find an alternative for MacOS.
Solution 1:[1]
There's a few workarounds, but no actual feature that'd make this clean or easy.
If you have a .app bundle, you can redirect through a shell script that appends some arguments. If you have an Info.plist with this:
<key>CFBundleExecutable</key>
<string>binary</string>
Then you'll want to change it to:
<key>CFBundleExecutable</key>
<string>binary_</string>
And create a Contents/MacOS/binary_ like so:
#!/bin/bash
"$(dirname "$0")/binary" +set fs_game "$@";
And give it a chmod +x.
That'll work no matter how you launch the app, but it will invalidate any existing code signature, so if your app was signed, you'll have to re-sign it.
If you have a standalone binary or if you can't afford to break the code signature, then basically the only option is to make a separate thing that invokes it the way you want. Write a bash script like so:
#!/bin/bash
open -a path/to/your.app --args +set fs_game;
Give it chmod +x and turn it into a separate app. This will obviously only work when invoked via that separate app, but it works with any kind of binary, and without the need to re-sign anything (and the separate app should only show up in your dock for a split second, then vanish again).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Siguza |
