A Mac Application is structured as a bundle. Assume you have a Hello World application in Objective-C, the most "by-hand" way to build the bundle would be so:
Code:
// Copied from: http://macosx-programming.blogspot.de/2011/09/simple-gui-hello-world-using-cocoa.html
#include <Cocoa/Cocoa.h>
int main(int argc, const char** argv)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
NSRunAlertPanel(@"Testing Message Box",
@"Hello, World!",
@"OK", NULL, NULL);
[pool release];
return 0;
}
Build (assuming the code is in hello.m
):
$ nano hello.m
$ clang hello.m -o hello -framework Cocoa
$ mkdir -p Hello.app/Contents/MacOS
$ cp hello Hello.app/Contents/MacOS/hello
Navigate to the folder where you made the Hello.app
folder, and you'll notice it actually can be started. If not, chmod +x
it.
Important: Normally, a Mac App uses a Info.plist
file to determine settings liek the display name, executable name, version and more. If none is given, the executable is expected to have the same name as the app - case insensitive.
Hope it helped =)