A1: macOS readiness: setup guide, cargo xtask mac-report, unix/macOS fixes

- docs/macos.md: step-by-step setup for a fresh Apple Silicon Mac (Xcode
  CLT, Homebrew, git, PHP, Composer, Node 22, pnpm, rustup, clone from
  Forgejo), the machine report, Gatekeeper notes, macOS differences and
  what Windows cannot check.
- cargo xtask mac-report: versions, the gate steps, the bundled-UI desktop
  build and a self-check over the control channel (project, file,
  Phpactor, hover, git.status, terminal, screenshot, quit); every step
  times out and runs in a lutra_proc group; one report.md to send back.
- Fixes: macOS native menu (system menus only; Cmd+W stays buffer.close,
  Cmd+Q runs app.quit), xcap screenshot region in points on macOS
  (Retina), login shell (-l, /bin/zsh fallback) and LANG for the
  terminal on macOS, PHP lookup in Homebrew/MacPorts dirs for Finder
  starts, case-insensitive LSP path mapping on macOS, rendezvous file
  mode re-set to 0600, CLI-started desktop in its own process group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-31 14:47:45 +01:00
parent da58c83158
commit 1bf69ded55
18 changed files with 1795 additions and 36 deletions

View file

@ -191,7 +191,9 @@ pub fn write(dir: &Path, instance: &Instance) -> io::Result<()> {
}
/// Creates `path` readable and writable by the owner only and writes
/// `bytes` to it.
/// `bytes` to it. On Unix the mode is set again after opening, because
/// `mode(0o600)` only applies when the file is created, and a stale
/// temporary file (same process id after a crash) keeps its old mode.
///
/// # Errors
/// If the file cannot be created or written.
@ -204,6 +206,11 @@ fn write_private(path: &Path, bytes: &[u8]) -> io::Result<()> {
options.mode(0o600);
}
let mut file = options.open(path)?;
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
file.set_permissions(fs::Permissions::from_mode(0o600))?;
}
file.write_all(bytes)?;
file.sync_all()
}