I'm in the process of developing a game written in C using SDL, and while I do all of my development on Windows/Linux machines would like to make it available on Mac as well. The code is fully platform agnostic, and I have successfully run it on a loaned Mac after compiling it using Xcode, but have been unable to get the executable file to run except when running it through the terminal (by opening the terminal, cd-ing through a bunch of files, then typing the appropriate command). Needless to say this is extremely user-unfriendly, and I would prefer the game run when the executable file is clicked on normally, but doing so instead opens a terminal window that immediately exits the program. I tried making a script file that does nothing but run the program, but even when placed in the same folder as the program it gives a 'no such directory' error. It likewise runs fine when run directly from the command line.

I've tried changing file permissions, they don't seem to affect anything. I'm somewhat familiar with Linux, but not very familiar with Macs and do not own one (I have one on loan that I'm using to port the game) and am limited in what I can do as a result of that. I am not currently interested in going through the process of becoming a registered Mac developer.

1 Answer 1


Application Bundle

The executable file needs to be placed within an application bundle – a special directory structure. The top-level directory has the extension .app.

See Building OSX App Bundle for a related question on StackOverflow.

  • To add to this a bit, Linux and Windows take a basically similar approach to launching an executable from the GUI: they start it as if from the command line. macOS demands .app bundles for launching from the GUI. The macOS command line is more conventional. Commented Apr 22, 2023 at 15:25
  • Thank you, this has been very helpful. Is there any way to build an app bundle in Xcode for a C project, or do you have to build it manually?
    – P...
    Commented Apr 23, 2023 at 17:01
  • 1
    You can probably use Xcode to build the bundle for you, but I recommend putting the time into writing a shell script that creates the directories and text files instead. Then you can run that .app packaging script on Windows or Linux. The answers to stackoverflow.com/questions/1596945 are a good starting point. Commented Apr 23, 2023 at 17:18
  • Alright, thanks for the advice.
    – P...
    Commented Apr 23, 2023 at 22:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .