Ships the offline-start fix for the Windows launcher and the before/after split.
8.6 KiB
macOS app (optional)
An additive, self-contained way to produce a double-clickable macOS app of
Luminary. The server and Docker workflow stay the source of truth: this folder
only packages the existing dist/ + server/ output, and the build writes
its artifacts outside the checkout.
Isolation guarantees
- The packaging tree is additive. There is no
package.jsonscript for this, and no change toDockerfile,docker-compose.ymlorscripts/deploy.mjs. Invoke it directly:node macos/build.mjs. The app uses the same desktop mode the Windows launcher uses (LUMINARY_LOCAL=1), which is off unless a launcher sets it. - Artifacts live outside the repo (default:
~/Library/Caches/luminary-macos). The script refuses an--outinside the checkout, becausescripts/deploy.mjsrsyncs the worktree to production anddocker buildwould pull the bundle into its context. - The worktree must be clean outside
macos/before and after a build (the untrackedlogo.pngis tolerated).--allow-dirtyoverrides it. - Nothing in the app changes at run time. The bundle is the unchanged
server/+dist/+ productionnode_modules, started withPORT,HOST,NODE_ENVandLUMINARY_DATA— all variables the server already reads.
It must run on macOS: the build needs clang, codesign, ditto, hdiutil,
sips and iconutil. The Windows bundle is the one that cross-builds from
Linux.
Quick start
On a fresh checkout run npm ci once: the UI build uses vite and tsc from
the dev dependencies, and the script copies the production dependencies into
the app itself.
node macos/build.mjs # host arch, Node 24, ad-hoc signature, zip + dmg
node macos/build.mjs --arch universal # arm64 + x86_64, both sharp slices
node macos/build.mjs --node v22.23.5 # minimum macOS 11.0 instead of 13.5
node macos/build.mjs --skip-build --sign none
Outputs:
~/Library/Caches/luminary-macos/
stage/Luminary.app
Luminary-0.5.3.1-mac-arm64.zip
Luminary-0.5.3.1-mac-arm64.dmg
cache/ # downloaded node tarballs, icon work
--publish copies the zip and dmg into macos/releases/ with a
SHA256SUMS.txt, for transfer to a Mac. .gitignore keeps those archives out
of git.
Bundle layout
Luminary.app/Contents/
Info.plist, PkgInfo
MacOS/Luminary native shim (main.c) -> execs the launcher
Resources/
launcher.sh start/stop/status/verify (bash)
Luminary.icns
version.txt, README-macos.txt
runtime/node official Node for the built architecture
app/
server/ unchanged, minus data/ and *.test.*
dist/ unchanged, including .br/.gz variants
node_modules/ production deps only (sharp for each slice)
package.json, LICENSE, THIRD_PARTY_NOTICES.md, licenses/
The main executable is a Mach-O shim, not a shell script. Apple treats
scripts in Contents/MacOS as resources, and the notary service rejects a
bundle whose main executable is not signed native code; the shim is a few lines
of C that execs bash launcher.sh, so the launcher stays editable without a
rebuild and the bundle can still be signed and notarized.
Node and the minimum macOS version
| Node | Bundled runtime minimum | LSMinimumSystemVersion |
|---|---|---|
| v22.18+ | macOS 11.0 | 11.0 |
| v24+ | macOS 13.5 | 13.5 |
Node 24's official macOS binaries are built against 13.5, so they cannot start
on Big Sur or Monterey; a macOS 11 build must bundle Node 22. Both lines run
this server: node:sqlite is unflagged from 22.13, type stripping (used by
server/denoise-worker.mjs importing a .ts pipeline) from 22.18, and the
HTTP integration suite passes under 22.23.5.
--node-bin uses a local binary instead of downloading one; the build warns if
otool -L shows libraries outside /usr/lib and /System (a Homebrew node
would drag Homebrew's ICU along and fail on a stock Mac).
Signing and notarization
Three modes:
--sign |
What it does | Users see |
|---|---|---|
adhoc (default) |
codesign --sign - on every Mach-O, then the bundle |
“Apple could not verify …”, one-time Open Anyway |
none |
no signature | the same, and arm64 Macs may refuse to launch it |
developer-id |
signs each nested Mach-O with the Developer ID, hardened runtime and JIT entitlements on executables, then the bundle | no warning |
Notarization needs a paid Apple Developer Program membership:
xcrun notarytool store-credentials luminary \
--apple-id you@example.com --team-id TEAMID --password APP_SPECIFIC_PASSWORD
node macos/build.mjs --arch universal \
--sign developer-id --identity "Developer ID Application: Brian Hursey (TEAMID)" \
--notarize luminary --publish
The build submits the zip, staples the .app, rebuilds the zip, then creates the
dmg and submits and staples that too. entitlements.plist contains
allow-jit, allow-unsigned-executable-memory and disable-library-validation
— Node needs the first two under the hardened runtime, and sharp loads libvips
as a dylib, which library validation would otherwise reject.
Without the certificate everything still works; the first-launch instructions in
README-macos.txt cover the Gatekeeper step. macOS 15 and 26 removed the
Control-click → Open bypass, so that text names the System Settings path.
Launcher behaviour
Same rules as the Windows launcher (windows/launcher/DESIGN.md):
- No mutex.
runtime.jsonin the data folder records pid/port, and/api/healthis the liveness test: a healthy recorded port is reused, a stale one is replaced. - Ports 8787–8887, loopback only. The chosen port is passed as
PORT. - Data defaults to
~/Library/Application Support/Luminary/data; an existingLUMINARY_DATAwins. Logs go to<data>/logs/. - Window: Chrome or Edge in
--appmode with its own profile in the data folder;--browserorLUMINARY_WINDOW=browseropens a normal tab; neither installed falls back to the default browser. - Server lifetime: detached, so closing the browser does not stop it and
reopening the app reuses it.
--stop(andStop Luminary.commandnext to the app in the dmg) terminates it;--statusprints pid, port, health and paths;--verifychecks the three files a complete bundle needs.
Test checklist (on the Tahoe machine)
node macos/build.mjs --arch universal --dmg→ zip and dmg exist; summary prints arch, Node version, target and hashes.codesign --verify --deep --strict --verbose=2 stage/Luminary.app→ valid.- Copy the app out of the dmg, open it → browser/app window opens on the editor, no sign-in screen (desktop mode).
- Launch again while it runs → same port is reused, no second node process;
pgrep -fl 'Resources/runtime/node'shows one. --stop→ process gone,runtime.jsonremoved;--stopagain says "not running".- Occupy 8787 with another listener → the app starts on 8788 and opens that URL.
- Import a raw, apply a film look, export → proves libraw WASM, sharp (dylibs load under the signature) and the export path.
- Denoise a photo → proves the
.tsworker under the bundled Node. - Quit the browser, reopen the app → the same catalog opens; the data folder holds the SQLite files.
--verifywith a renamedruntime/node→ exit 3 and a dialog, not a silent failure.- Path with spaces / non-ASCII in
LUMINARY_DATA→ starts and writes there. - Gatekeeper: download the zip through a browser (quarantine flag), then follow README-macos.txt → one-time Open Anyway, then normal launches.
- On an Intel Mac: the same bundle runs (universal, both sharp slices).
- Optional: notarized build → double-click installs with no warning,
spctl -a -vv -t exec Luminary.appsaysaccepted.
Known limits
- No Dock menu. The launcher exits once the browser opens; stopping is
--stop/Stop Luminary.command, not a Quit menu item. - Ad-hoc signing is per-bundle. Copying the app with an archiver that drops
extended attributes can make macOS call it damaged; the zip is made with
dittofor that reason. - Universal builds install sharp twice (one
npm ciper architecture) and copy the second slice's@imgpackages across; this is tested for layout, not for runtime, until both architectures are exercised. - Icon quality depends on the source.
public/logo.pngis 147×160, so the generated.icnsis soft; pass--iconwith a 1024×1024 PNG for a release. - No auto-update, no file associations, no login item. Same phase-2 list as Windows.