Alan
Alan

Reputation: 91

Why does my Firemonkey app open a terminal window on OSX but not on Win32?

I created a simple testbed app in Delphi XE2, and compiled both a Win32 and OSX version of the application.
I zipped up the OSX version, along with a copy of the libcgunwind dylib runtime file and copied this files to a Mac i have access to.
When I unzipped the file, the mac recognized my OSX application and I double clicked it.

This, in turn, opened up a terminal window for some unknown reason along with my simple app's form.
The application itself ran and behaved just fine, but I'm curious why a terminal window would open up on the Mac?

Upvotes: 9

Views: 1882

Answers (3)

Marcus Adams
Marcus Adams

Reputation: 53870

Your application needs to be run from the application bundle. If you run it directly, you'll get the side effect of seeing the terminal window with the command line that is running the application.

You'll want to read more about Application Bundles.

If you're using PAServer, after you run the program for the first time on the Mac, look in the following folder on the Mac for the application bundle:

/Users/[username]/Applications/Embarcadero/PAServer/scratch-dir/[profilename]

If your project is named Project1, you'll see an application bundle in that folder named Project1.

If you read the above wiki article, you'll know that Project1 has a "hidden" extension of .app, and the whole thing is really a folder with all of the required files to run the application.

To the Mac OS user, the application bundle appears as a single program file, complete with an icon. The user can double-click the application bundle to run the application, drag it to their dock, etc.

The application bundle will have the Delphi icon by default, but you can replace it with your own icon. On the Mac, simply right-click on the application bundle in Finder, and select Show Package Contents. In there, look in the Contents/Resources folder for the .icns file.

Use the Icon Composer application that was installed with XCode to create your .icns icon file from existing image files.

Peek around inside at the rest of the contents. You'll see the required dylib, your program file, and the Info.plist file, which is a text file with things like application IDs, signatures, and other important things.

Upvotes: 0

Nick C
Nick C

Reputation: 31

There is a free tool available for Delphi XE2 that will create the OSX deployment app bundle for you, from Windows, without the need for PAServer.

http://enesce.com/delphiosx_bundler

Check the readme for instructions.

Upvotes: 3

Marco van de Voort
Marco van de Voort

Reputation: 26376

IIRC this happens if you execute the binary directly instead via a bundle

Lazarus/FPC apps had the same problem. IIRC the directly executed binary also didn't get events under those circumstances, but those apps were Carbon based. That problem also went away when running via a bundle setup (which is pretty much a manifest, a few dirs and a symlink)

Upvotes: 2

Related Questions