Skip to content

[macOS] release app silently rewrites itself on first launch (unpacks Resources/<hash>.tar.zst) #359

@theopak

Description

@theopak

Summary

Opening a built production Electrobun app for the first time increases the app's size while it self-unpacks an internal <hash>.tar.zst artifact. This can cause first-launch to fail until second launch when it takes too long, or to fail permanently if storage is full. It doesn't unpack until first launch.

In my case, it made an Electrobun app 4x bigger after opening it for the first time. From an end-user perspective, this breaks the expectation that the .app in the .dmg is already the size needed to install by dragging into the Applications folder.

Observed

  • In non-dev macOS builds, the shipped .app is a wrapper containing Contents/Resources/<hash>.tar.zst.
  • On first launch, it unpacks into the bundle (new files under Contents/MacOS and Contents/Resources/app).
  • App size increases after first open, and first launch takes longer.
  • This can fail on low free disk, because install-time footprint is smaller than steady-state footprint.

Expected

  • A copied .app should be in its final on-disk state at install time (or at least offer a mode for that).
  • No silent first-launch extraction that mutates bundle contents and changes app size.

Repro

  1. Build a minimal Electrobun app with non-dev env (build --env=stable or equivalent production env).
  2. Before first run:
    • du -sh "/Volumes/My App/My App.app"
    • ls "/Volumes/My App/My App.app/Contents/Resources" (contains <hash>.tar.zst)
  3. Copy to Applications and launch once:
    • cp -R "/Volumes/My App/My App.app" "/Applications/My App.app"
    • open "/Applications/My App.app"
  4. After first run:
    • du -sh "/Applications/My App.app" (larger)
    • Contents/MacOS and Contents/Resources/app now contain extracted runtime files.

Suggestion

What do you think of adding an ElectrobunConfig option to disable self-extract packaging on macOS (ship fully expanded bundle; skip creating/extracting .tar.zst)?

Context (Apple docs)

Additional Information

  • Electrobun 1.16.0
  • Bun 1.3.11 macOS Silicon
  • macOS 26.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions