Skip to content

Add macOS packaging (launchd user agent + .pkg or Homebrew formula) #17

@kramerc

Description

@kramerc

Follow-up to #16 (RPM + MSI packaging). macOS was explicitly out of scope there; this issue tracks adding it.

What we'd ship

  • .pkg installer, Homebrew formula (in a tap), or both. .pkg is the direct equivalent of the MSI/RPM story; Homebrew is what most macOS Rust users will reach for.
  • A per-user launchd agent (~/Library/LaunchAgents/com.kramerc.presence-switch.plist) — the macOS analogue of the systemd user unit. Loaded on login via launchctl bootstrap gui/\$UID. No sudo, no admin password.

Why launchd user agent, not LaunchDaemon

System-wide LaunchDaemons need admin rights to install and run as root, which is wrong for Discord IPC (per-user named sockets). User agents match the per-user model we already established for RPM (systemd --user) and MSI (HKCU Run-key).

Build approach

  • Cross-compile from Linux runner: cargo build --target aarch64-apple-darwin + cargo build --target x86_64-apple-darwin, then lipo into a universal binary. Apple's SDK headers are needed (free, but requires a license click-through on Apple's side).
  • Or use a macos-latest runner in CI. Costs more minutes than Linux runners but no SDK fuss.

Sketch of work

  • Decide on distribution channel(s): .pkg, Homebrew tap, or both
  • Author the .plist launchd template (per-user agent, RunAtLoad, KeepAlive)
  • If .pkg: use pkgbuild + productbuild on a macOS runner, or xar + payload on Linux (more fragile)
  • If Homebrew: separate tap repo with a Formula that pulls the GitHub Release artifact
  • Add a mac job to .github/workflows/package.yml
  • Code-signing + notarization for .pkg (requires an Apple Developer account at $99/yr; without it, Gatekeeper requires right-click → Open dance)
  • README install instructions

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpackagingDistribution package format (RPM, deb, MSI, pkg, etc.)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions