Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Starpack on Mac Starts Terminal Window

51 views
Skip to first unread message

Westermeyer

unread,
Jul 10, 2022, 3:09:36 PM7/10/22
to
Hello,

I've got a general question about starpacks on the Mac - I'm running Mac High Sierra, and everything goes well for launching my application. There's one problem, and that is that I can't stop the terminal from executing when I launch my file (it's a Tk project).

Output in the terminal looks like this:
Last login: Sun Jul 10 11:53:09 on ttys001
Stephens-Mac-mini:~ stephen$ /Users/stephen/Desktop/TclKit/Main ; exit;

I've had a look at $argv and $argc, but the count of $argc is 0. I was hoping to trap these, and maybe it would prevent a terminal from opening. So, not much there.

There's a Mac variable called "PSN" which might be relevant, but I can't trap it if it is there, because, well, $argc = 0, nothing is being sent.

Kind of a mystery...

Robert Heller

unread,
Jul 10, 2022, 5:06:17 PM7/10/22
to
At Sun, 10 Jul 2022 12:09:34 -0700 (PDT) Westermeyer <stephen.sc...@gmail.com> wrote:

>
> Hello,
>
> I've got a general question about starpacks on the Mac - I'm running Mac High Sierra, and everything goes well for launching my application. There's one problem, and that is that I can't stop the terminal from executing when I launch my file (it's a Tk project).
>
> Output in the terminal looks like this:
> Last login: Sun Jul 10 11:53:09 on ttys001
> Stephens-Mac-mini:~ stephen$ /Users/stephen/Desktop/TclKit/Main ; exit;

It is a "feature" of MacOSX that if you directly run a TclKit it will launch
Terminal -- this is true of *any* "bare" executable file, unless you launch it
from a shell -- eg from an already running Terminal (or indeed from a SSH
login). To prevent this, you need to create an "Application Bundle". An
"Application Bundle" is a directory (folder) with a name ending in ".app",
which contains a directory structure like this:

Assuming an executable named "foo", an "Application Bundle" for foo would look
something like this. The pngs are just the variously sized/scaled icons for
the foo application. Finder will use different ones in different situations
-- desktop, launcher, menus, etc.

foo.app/Contents/Info.plist
/MacOS/foo
/Resources/foo.iconset/icon_1...@2x.png
icon_2...@2x.png
icon_5...@2x.png
icon_128x128.png
icon_256x256.png
icon_512x512.png
icon_...@2x.png
icon_...@2x.png
icon_16x16.png
icon_32x32.png


Info.plist might look something like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>RolePlayingDB3</string>
<key>CFBundleDisplayName</key>
<string>RolePlayingDB3</string>
<key>CFBundleIdentifier</key>
<string>com.deepsoft.RolePlayingDB3</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>ttxt</string>
<key>CFBundleExecutable</key>
<string>RolePlayingDB3</string>
<key>CFBundleLongVersionString</key>
<string>Version 1.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleGetInfoString</key>
<string>RolePlayingDB3 Version 1.0</string>
<key>CFBundleIconFile</key>
<string>RolePlayingDB3</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright 1994,1995,2002-2005,2022 Robert Heller D/B/A Deepwoods Software</string>
</dict>
</plist>

Most of the above is pretty obvious -- either boilerplate or otherwise is some
relevant feature of your application (eg its name, its version, it author,
etc.).

There exist utilities (I think they are part of the developer kit) to create a
"binary" plist, and a more compact version of the icons (some sort of icon
bundle file).

>
> I've had a look at $argv and $argc, but the count of $argc is 0. I was hoping to trap these, and maybe it would prevent a terminal from opening. So, not much there.
>
> There's a Mac variable called "PSN" which might be relevant, but I can't trap it if it is there, because, well, $argc = 0, nothing is being sent.
>
> Kind of a mystery...

Not really, just a "weirdness" with MacOSX -- I believe it is something
relating to the olden days of "Classic" MacOS, intended to make things "User
Friendly" (whatever that means).

>
>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

Westermeyer

unread,
Jul 10, 2022, 9:17:44 PM7/10/22
to
Hello Robert,

Thanks for this really valuable feedback. I'm totally new to the Mac platform and didn't realize I was at the point where a bundle was needed. I think the good news is that once a bundle is created, it you can continue to reuse it as the project develops...

Steve

Robert Heller

unread,
Jul 11, 2022, 7:29:01 AM7/11/22
to
For the project I have that target MacOSX, I have the bundle creation code as
part of the build infrastructure -- in the Makefile(s), along with build
scripts to generate the plists. So creating the bundle is just a part of the
overall build process.
0 new messages