Skip to content

On macOS, make bundle builds a signed Hush.app and make install puts it in /Applications - #268

Merged
pitis merged 3 commits into
mainfrom
feat/macos-app-bundle
Nov 29, 2026
Merged

pitis merged 3 commits into
mainfrom
feat/macos-app-bundle

Conversation

@pitis

@pitis pitis commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

On macOS the GPUI app now builds into a real Hush.app. Run as a bare program, it got no notifications (macOS shows them only to an app bundle), and the keychain asked for its key after every rebuild.

What changed

  • make bundle (scripts/bundle.sh): builds the release hush (cargo build --release -p hush-desktop, the workspace release profile as is) and assembles core/target/bundle.noindex/Hush.app:
    • Info.plist: bundle id dev.pitis.hush, name and display name Hush, executable hush, both versions from the crate (cargo pkgid, now 0.1.0), LSMinimumSystemVersion 12.0 (GPUI's Metal shaders are built for macOS 12, gpui-pre-apple's build.rs), NSHighResolutionCapable, category social-networking. CFBundleIconFile/CFBundleIconName come from actool's partial plist.
    • The icon: xcrun actool compiles core/desktop/AppIcon.icon into Assets.car (macOS 26's layered icon) and AppIcon.icns (earlier systems'). No fallback was needed. actool can fail without a word and exit 0 (a missing or malformed icon), so the script checks that both files were made. It shows actool's output when actool exits non-zero or reports errors or warnings.
    • Signing: hardened runtime (--options runtime), no entitlements. Nothing the app does outside the sandbox needs one: network, the login keychain through keyring, notifications, file pickers, audio playback. It makes no calls, so it needs no microphone. It links only system libraries. The script signs with the Apple Development identity of team 95KQ82C586 when one is in the keychain. It finds it by the certificate's OU, because the name shows a member id, not the team. A failed lookup stops the script instead of reading as "no identity". Otherwise it signs ad-hoc and warns that the keychain will ask after every rebuild. It then runs codesign --verify --strict --deep.
    • Stray copies: the build folder ends in .noindex, so Spotlight doesn't index it. Spotlight indexing is how macOS registers a bundle it sees. The script also unregisters the built copy (lsregister -u; only "not registered", -10814, is ignored), so the Dock and Spotlight open only the installed one.
  • make install: the same build, copied whole beside /Applications/Hush.app first (ditto), then swapped in and registered (lsregister -f), so a full disk leaves the old app in place. That removes the old Swift Hush.app if it is still there. Its data and keychain item stay.
  • README: how to build and install, what signing means for the keychain key the bundle reads (dev.pitis.hush/db-key, the former Swift app's since On macOS the desktop app opens the Mac app's data, linked, with its drafts and settings #266), and that development runs with HUSH_DATA_DIR never ask. CLAUDE.md: a stack rule for the bundle, its signing and its bundle id (it replaces the Mac app's signing rule that Hush is the Rust core and the GPUI app: the Swift Mac app and its build are gone #265 removed), and the two commands. DESIGN.md: macOS notifications come from Hush.app only. APP_ID's doc says it is Hush.app's bundle id.
  • Comments now match the bundle (no behaviour change):
    • notifications.rs: macOS shows GPUI's notifications only from the bundle, and GPUI asks for permission at the first one. The shortcut: stays for Reply, sound and threads, the follow-up the issue names.
    • login.rs: the LaunchAgent stays, because the app also runs unbundled. It opens this executable, which from the bundle is Hush.app/Contents/MacOS/hush (current_exe).

Checked against GPUI (gpui-pre-macos 0.3.11)

  • system_notifications.rs only creates UNUserNotificationCenter when NSBundle.mainBundle.bundleIdentifier is set. Without a bundle, that call would abort the process. It asks for authorization (alert and sound) at the first notification and shows banners while Hush is frontmost.
  • set_app_identity does nothing on macOS. The bundle id comes from Info.plist only.

How it was tested

  • make bundle on this Mac (no Apple Development identity, so ad-hoc): it builds and signs, codesign --verify --strict --deep -vv says "valid on disk / satisfies its Designated Requirement". codesign -dvvv shows Identifier=dev.pitis.hush and flags=0x10002(adhoc,runtime), with no entitlements.
  • plutil -lint OK, and plutil -p shows the values above. assetutil --info Assets.car lists AppIcon as an IconImageStack (light, dark, tinted) plus 16–1024 px images. AppIcon.icns has 16 to 256 px images.
  • otool -L: system frameworks and dylibs only. The binary's minos is 11.0 (below the plist's 12.0).
  • spctl -a -vv: rejected, as expected for an ad-hoc, unnotarized app. It isn't quarantined, so it opens on the Mac that built it.
  • LaunchServices: the built copy isn't in lsregister -dump, and mdfind finds only /Applications/Hush.app.
  • Picking the signing identity: tested in scratch with stubbed security output and real certificates made with openssl (LibreSSL and OpenSSL 3). It takes the team's Apple Development identity and skips another team's and a Developer ID. With a real certificate it is untested, because there is none on this Mac.
  • No new Rust test: no code behaviour changed (comments only). The script checks its own output: the icon files, plutil -lint, and codesign --verify.
  • Gate (make check) on the head merged with On macOS the desktop app opens the Mac app's data, linked, with its drafts and settings #266 and DESIGN.md and PRODUCT.md describe the GPUI app as it is, on macOS, Windows and Linux #269, from core/: cargo fmt --check pass; cargo clippy --all-targets -q -- -D warnings pass; cargo clippy --all-targets --features hush-desktop/snapshot -q -- -D warnings pass; cargo test --features hush-desktop/snapshot -q pass (desktop 363, core 541). make bundle on that head: built, signed ad-hoc with the runtime, verified. The release link prints duplicate-symbol warnings from cubeb-sys's bundled Rust objects; they were there before (make perf builds the same) and the build succeeds.
  • Skipped: the app was not launched. A launch would read the owner's real key with a keychain prompt and open a window. So "opens" and "shows notifications" are for the owner to confirm once on the installed app (macOS asks to allow notifications at the first one). There is no Swift leg any more.

For the owner

  • Build and install: make install (quit Hush first). At the first launch of each ad-hoc build, macOS asks whether Hush may use its key: enter the login password and choose Always Allow.
  • With the Apple Development certificate (team 95KQ82C586) in the login keychain, make bundle picks it on its own. The first signing may ask to let codesign use the key (Always Allow). The bundle reads the former Swift app's key (dev.pitis.hush/db-key). If a team-signed Swift build made that key, it opens without asking. Otherwise it asks once, then never after a rebuild. The Swift Hush.app now in /Applications on this Mac is signed ad-hoc, so one prompt is possible.
  • Development runs with HUSH_DATA_DIR keep the key in a file and never ask, whether through make run or the bundle's Contents/MacOS/hush.
  • LaunchServices still lists about 20 old Swift Hush.app builds from earlier worktrees and scratch folders (lsregister -dump | grep 'path:.*Hush.app'). They have the same bundle id. Unregister them with lsregister -u <path> if the Dock opens the wrong one.

Closes #264

…it in /Applications

The GPUI app ran on macOS as a bare program: no notifications (macOS
shows them only to an app bundle) and a keychain prompt after every
rebuild. scripts/bundle.sh builds the release hush and assembles
Hush.app: Info.plist (dev.pitis.hush, version from the crate, macOS 12
as GPUI's shaders need), the icon compiled from AppIcon.icon by actool,
the hardened runtime. It signs with the team's Apple Development
identity when the keychain has one, else ad-hoc with a warning. The
build folder ends in .noindex and the built copy is unregistered from
LaunchServices, so the Dock and Spotlight open only the installed one.
README and CLAUDE.md say how to build, install and sign; comments on
notifications and open at login now describe the bundle.
…s before it replaces

Review fixes. actool's output is shown when it fails or warns (it can
also fail silently with exit 0, so the made files stay the test). The
identity lookup's own failures stop the script instead of reading as
"no identity". make install copies the new app beside the installed
one before swapping them, so a full disk leaves the old one. Only
lsregister's "not registered" is ignored. Docs: the keychain note no
longer assumes the Mac app's key, the bundle id is the removed Mac
app's, and the notification shortcut says when to upgrade.
@pitis

pitis commented Nov 29, 2026

Copy link
Copy Markdown
Owner Author

Review (/pr-review-toolkit:review-pr: code-reviewer, silent-failure-hunter, comment-analyzer)

All fixes are in a0bac7d. The gate was run again (make check) and passed: desktop 344 tests, core 541. make bundle was run again: codesign --verify --strict --deep passes, the app is signed ad-hoc with the hardened runtime, and the bundle is not registered with LaunchServices.

Critical and Important findings, all fixed

  • README: a false keychain claim (comment-analyzer and code-reviewer). It said a key "the Mac app made" would open without asking. On main the desktop app still has its own key, so that never happens there. Now it reads: "once at most, and never for a key made by an app signed with that identity". That holds before and after On macOS the desktop app opens the Mac app's data, linked, with its drafts and settings #266.
  • Signing could fall back to ad-hoc silently (silent-failure-hunter). Failures of security find-identity, find-certificate or openssl were not seen, because they ran inside a process substitution or an if condition. Each now runs in an assignment that errexit checks, so a broken lookup stops the script. The warning now says "no valid identity" and names the command that lists them, which covers expired certificates.
  • actool's errors were thrown away (silent-failure-hunter). Its output is now shown when it exits non-zero or reports errors or warnings. A malformed icon.json makes actool exit 0 and print nothing (tested), so the check that both icon files exist stays as the real test, and it now runs before the plist merge.
  • make install could leave no app (silent-failure-hunter and code-reviewer). It deleted the installed app before copying the new one. Now it copies to /Applications/Hush.app.new, then swaps the two.
  • The shortcut: in notifications.rs had no upgrade trigger left (comment-analyzer). Its trigger was "once the app ships as a bundle", which this PR does. It now says: "when they're wanted on macOS".
  • CLAUDE.md didn't say the bundle id is the removed Mac app's (comment-analyzer). Added, with the two effects: make install replaces that app's /Applications/Hush.app, and its notification permission carries over.

Suggestions taken

  • lsregister -u now ignores only -10814 ("not registered"). Any other failure gives a warning.
  • Wording fixes:
    • notifications.rs no longer says "only" twice in one sentence, and says macOS asks for notification permission once per bundle id.
    • The README now says Gatekeeper lets the app open only on the Mac that built it.
    • The README and the script header now say "until the build itself is opened".

Declined, with reasons

  • Make --install refuse an ad-hoc build: the issue already settled this: without the identity the build is ad-hoc, with a warning.
  • An ERR trap that deletes a half-built Hush.app: the failing tool's own error is already printed. A half-built copy lives in a .noindex folder, isn't registered, and the next run replaces it.
  • Find the certificate by SHA-1 instead of by name: certificates with the same name belong to the same member of the same team, so any of them answers the team question.
  • Check CFBundleIconName after the merge: if actool made both files, it also wrote the keys. PlistBuddy fails loudly on a missing or empty partial plist.
  • The APP_ID doc in notifications.rs: On macOS the desktop app opens the Mac app's data, linked, with its drafts and settings #266 rewrites that line. Changing it here would only cause a conflict. I'll look at it again when this branch is updated after On macOS the desktop app opens the Mac app's data, linked, with its drafts and settings #266.
  • "(the Mac app's LoginItem)" in login.rs: the desktop code names its Mac app counterpart throughout (AppStore.swift, Notifications.swift). Removing that in one file is out of scope.

For the owner, not changed here

  • The first notification may be lost while macOS shows the permission prompt. GPUI posts it without waiting for the answer. This is unverified.
  • If the old Swift app had Open at login on, its login item uses the same bundle id and may now open the new app. It does that without the app's own Settings toggle showing it. Turn it off in the Swift app before installing (On macOS the desktop app opens the Mac app's data, linked, with its drafts and settings #266's switching steps), or remove it in System Settings ▸ General ▸ Login Items.

@pitis

pitis commented Nov 29, 2026

Copy link
Copy Markdown
Owner Author

Merged origin/main (#266, #269) in 6c6df68.

  • The README conflict is resolved and keeps both sides: On macOS the desktop app opens the Mac app's data, linked, with its drafts and settings #266's data folder and HUSH_DATA_DIR paragraph, then the bundle section.
  • The wording now matches the merged state:
    • Hush.app reads the former Swift app's dev.pitis.hush/db-key.
    • With the team certificate, the keychain trusts every rebuild. A key a team-signed Hush made opens without asking, and any other key asks once.
    • Ad-hoc builds ask once per build.
    • HUSH_DATA_DIR development runs never ask.
  • CLAUDE.md's bundle rule says the same.
  • DESIGN.md's notification row now says macOS shows them from Hush.app only.
  • APP_ID's doc now names Hush.app's bundle id.

On the merged head:

  • make check passes: desktop 363, core 541.
  • make bundle builds and signs ad-hoc with the hardened runtime, and codesign --verify --strict --deep passes.

@pitis
pitis merged commit 37f43b8 into main Nov 29, 2026
@pitis
pitis deleted the feat/macos-app-bundle branch November 29, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The GPUI app ships on macOS as a signed Hush.app

1 participant