fix(desktop): make locally-built macOS app relaunchable after in-place self-update - #36198
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On macOS the desktop app is built locally and ad-hoc signed (users have no Developer ID). An ad-hoc bundle has no stable Designated Requirement (no Team ID), so when the self-updater rebuilds it in place with a fresh build (new cdhash) — plus the
com.apple.quarantineflag inherited from the downloaded installer's process chain — Gatekeeper/LaunchServices treats the changed code as tampering and macOS reports "Hermes is damaged and can't be opened," then fails to relaunch.Repro (fresh Mac, happy path): download the signed/notarized thin installer → install (builds
Hermes.applocally) → first launch works → click Update in-app → "Hermes is damaged," app does not reopen. First launch works because it's a fresh registration; the in-place relaunch is what breaks.Fix
After building the desktop app locally, strip quarantine xattrs and re-apply a clean deep ad-hoc signature (omitting the hardened-runtime flag an ad-hoc build can't satisfy), so the rebuilt bundle relaunches.
Applied in both build entry points so it ships via
hermes update(git) with no installer re-download:hermes_cli/main.pycmd_gui— thehermes desktop --build-onlypath the updater drives.scripts/install.shinstall_desktop— first install, for parity.Both are no-ops on non-macOS and when a real signing identity (
CSC_LINK/APPLE_SIGNING_IDENTITY) is configured, so signed/notarized builds are never clobbered.Why this is the right layer
The signed+notarized thin installer (
Hermes Setup) is the downloaded artifact and is unaffected. The big ElectronHermes.appis always built on the user's machine (ad-hoc), so making the locally built app relaunch-safe is the correct fix — and putting it in the build path means existing installs self-heal on their nexthermes update.Test plan
python -c "import ast; ast.parse(...)"onmain.py,bash -n scripts/install.shpass.flags=0x10002(adhoc,runtime)and that an in-place ad-hoc rebuild is what trips the "damaged" check.