3

I have written a (GUI) Python script which requires one external file and one module (in a folder). In order to package this script for distribution to others, I am using the following application file structure:

└── Contents
    ├── Info.plist
    └── MacOS
        ├── colors.py
        ├── MainScript.py
        └── <module>
            ├── <module files>

Info.plist looks like this:

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleExecutable</key>
    <string>MainScript.py</string>
</dict>
</plist>

MainScript.py begins with #!/usr/bin/env python3 and was made executable with chmod +x.

When I double click the .app, it momentarily appears in the dock then vanishes. The strange part is that open MyApp.app does work correctly when in the enclosing folder (as well as ./MainScript.py when in the MacOS folder). What am I doing wrong?

  • Welcome to Ask Different. Packaging is a somewhat involved situation on macOS so in general, it's on topic here if it's something a system admin or motivated scripture might do. I've migrated your other question to SO since it's really programming as the main point. Thanks for asking a detailed / well documented question. Be sure to read the help center and Ask Different Meta if you're tempted to ask about off site resources (for example - good books on packaging, etc...) - those get closed if they're not up to the community standards for a useful recommendation. This one is fine so +1 – bmike Oct 27 '18 at 20:29
1

One thing I’d try is to use a tool like Platypus to help assemble the application bundle.

It might be easier to narrow down what part of the console log errors are relevant if you can diff your hand crafted app bundle and compare it with the one the tool assembles for you.

| improve this answer | |

You must log in to answer this question.

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