-
Notifications
You must be signed in to change notification settings - Fork 4
macOS release app crashes on launch because packaged resource bundle is only copied under Contents/Resources #1
Description
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
- Download/open the distributed
Phemy.dmg - Drag
Phemy.appinto/Applications - 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.bundleBut 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.