9

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?

Johan
  • 74,508
  • 24
  • 191
  • 319
Alan
  • 91
  • 2
  • I'm guessing it has something to do with the `libcgunwind dylib runtime file` you deployed with it. – Johan Sep 09 '11 at 16:03
  • I readily admit i'm a complete Mac OSX newb, for lack of a better word. with the dylib, the application wouldn't run. Do the dylib files need to go in a special directory? Do i have to 'install' the application somewhere specific on the mac for it to run properly? These are the things i'm clueless about. – Alan Sep 09 '11 at 16:11
  • my wife has a MacBook and that's as far as my Mac knowledge goes, I think you might try to put this issue before the folks at http://apple.stackexchange.com/ – Johan Sep 09 '11 at 16:23
  • In the webinar, David I showed deployment to a mac. There was a terminal window open, and it seemed to be acting as a deployment bridge between the PC and Mac. I think it was listening on a network socket, dropping files into the Mac on behalf of the Delphi IDE. I don't know if this is the same window that you saw or not, but this may explain it. – Chris Thornton Sep 09 '11 at 17:34
  • no, i didn't use that approach since i don't have a mac in my office. I compiled/zipped/transferred to a mac remotely, unzipped and launched. – Alan Sep 09 '11 at 19:06

3 Answers3

3

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.

Nick C
  • 31
  • 1
2

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)

Marco van de Voort
  • 25,628
  • 5
  • 56
  • 89
0

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.

Marcus Adams
  • 53,009
  • 9
  • 91
  • 143