Skip to content

macOS release app crashes on launch because packaged resource bundle is only copied under Contents/Resources #1

@eggie-1988

Description

@eggie-1988

Summary

The packaged macOS app crashes immediately on launch because SwiftPM's generated resource bundle accessor tries to load PhemyNative_PhemyNative.bundle from the app bundle root, but the DMG packaging script only copies that bundle into Contents/Resources.

Affected release

Observed with the distributed Phemy.dmg built from the phemy-1.2.0 source archive. The installed app still reports version 0.1.0 (1).

Reproduction

  1. Download/open the distributed Phemy.dmg
  2. Drag Phemy.app into /Applications
  3. Launch the app

Actual result

The app crashes immediately on startup.

Launching from Terminal prints:

PhemyNative/resource_bundle_accessor.swift:12: Fatal error: could not load resource bundle: 
from /Applications/Phemy.app/PhemyNative_PhemyNative.bundle 
or /Users/shivgarge/Kord-Native/.build/arm64-apple-macosx/release/PhemyNative_PhemyNative.bundle

Why this happens

scripts/create-dmg.sh currently copies the SwiftPM resource bundle here:

$APP_DIR/Contents/Resources/PhemyNative_PhemyNative.bundle

But the generated runtime accessor first probes the app bundle root:

/Applications/Phemy.app/PhemyNative_PhemyNative.bundle

So the packaged app cannot resolve Bundle.module and traps during launch.

Local workaround that fixes launch

Creating an app-root symlink makes the app launch normally:

ln -s "/Applications/Phemy.app/Contents/Resources/PhemyNative_PhemyNative.bundle" "/Applications/Phemy.app/PhemyNative_PhemyNative.bundle"

Proposed fix

Update the DMG packaging step to also create a compatibility symlink at:

$APP_DIR/PhemyNative_PhemyNative.bundle -> Contents/Resources/PhemyNative_PhemyNative.bundle

That keeps the normal macOS resource layout while satisfying the generated accessor used by the built executable.

I have a patch prepared and can open a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions