Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

test(macos): pin the helper-unavailable taxonomy and the deployment floor

Etienne Lescot08b30420e383
diff --git a/README.md b/README.md
index 679bc12d3..43c477e2e 100644
--- a/README.md
+++ b/README.md
@@ -65,7 +65,7 @@ Every platform has a recommended route below. On Windows that is the Microsoft S
### System requirements
- **Windows**: version 1903+ (build 18362) with Intel 8th Gen / AMD Ryzen 2000 series or newer minimum; Windows 11 with Intel 12th Gen / Ryzen 4000 series or newer recommended
-- **macOS**: 12.3 (Monterey) or later — required by ScreenCaptureKit for native capture
+- **macOS**: 12 (Monterey) or later; macOS 13 (Ventura) or later for native ScreenCaptureKit capture. On macOS 12 recording falls back to the browser pipeline, with fewer capabilities (see [Platform differences](#platform-differences))
- **Linux**: `xdg-desktop-portal` and PipeWire for native capture and system audio; recording still works without them through the browser-capture fallback, with fewer capabilities (see [Platform differences](#platform-differences))
- **RAM**: 8 GB minimum, 16 GB recommended
@@ -170,7 +170,7 @@ You may need to grant screen recording permissions depending on your desktop env
Everything in the editor and export is the same on macOS, Windows, and Linux: zooms, backgrounds, motion blur, crop/trim/speed, blur regions, annotations, auto-captions, AI editing, projects, export, and all languages. All three now record through a native capture pipeline; the remaining differences are narrower than they used to be:
-- **Native recording**: macOS (ScreenCaptureKit), Windows (Windows Graphics Capture), and Linux (PipeWire via the ScreenCast portal) all record through a native pipeline for higher quality and clean window-level capture. On Linux the browser pipeline stays as an automatic fallback if the helper isn't available.
+- **Native recording**: macOS (ScreenCaptureKit), Windows (Windows Graphics Capture), and Linux (PipeWire via the ScreenCast portal) all record through a native pipeline for higher quality and clean window-level capture. The browser pipeline stays as an automatic fallback on Linux if the helper isn't available, and on macOS 12, where ScreenCaptureKit capture requires macOS 13.
- **Custom cursors**: on macOS and Windows the real cursor is captured with shape, type, and clicks. Linux captures position and cursor shape through the portal, so cursor themes and the editable cursor overlay work there too — but the portal reports no mouse button events, so **click effects remain macOS and Windows only**.
- **Webcam**: Windows muxes the webcam natively into the recording; macOS and Linux record it alongside as a separate file. It works as a picture-in-picture overlay on all three.
- **System audio** support varies by OS:
diff --git a/electron/native-bridge/cursor/recording/macNativeCursorAccess.test.ts b/electron/native-bridge/cursor/recording/macNativeCursorAccess.test.ts
new file mode 100644
index 000000000..51a3f2c1c
--- /dev/null
+++ b/electron/native-bridge/cursor/recording/macNativeCursorAccess.test.ts
@@ -0,0 +1,168 @@
+import { EventEmitter } from "node:events";
+import { PassThrough } from "node:stream";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+/**
+ * The cast on `actual` is written out in the factory rather than shared in a
+ * helper: `vi.mock` calls are HOISTED above every top-level statement, so a
+ * module-scope helper is still in its temporal dead zone when the factory runs.
+ */
+type WithDefault = { default?: Record<string, unknown> };
+
+vi.mock("node:child_process", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("node:child_process")>();
+ const spawn = vi.fn();
+ return { ...actual, spawn, default: { ...((actual as WithDefault).default ?? {}), spawn } };
+});
+
+vi.mock("node:fs", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("node:fs")>();
+ // No helper binary exists in a test checkout; pretend the first candidate path
+ // is executable so path resolution is not what is under test.
+ return {
+ ...actual,
+ accessSync: vi.fn(),
+ default: { ...((actual as WithDefault).default ?? {}), accessSync: vi.fn() },
+ };
+});
+
+const mocks = vi.hoisted(() => ({
+ isTrustedAccessibilityClient: vi.fn(() => true),
+}));
+
+vi.mock("electron", () => ({
+ systemPreferences: { isTrustedAccessibilityClient: mocks.isTrustedAccessibilityClient },
+ screen: {
+ getCursorScreenPoint: () => ({ x: 0, y: 0 }),
+ getDisplayNearestPoint: () => ({ scaleFactor: 2 }),
+ },
+}));
+
+import { spawn } from "node:child_process";
+import {
+ isMacCursorHelperUnavailable,
+ requestMacCursorAccessibilityAccess,
+} from "./macNativeCursorRecordingSession";
+
+/** Minimal stand-in for the cursor helper: stdio pipes plus kill bookkeeping. */
+class FakeHelper extends EventEmitter {
+ stdout = new PassThrough();
+ stderr = new PassThrough();
+ killed = false;
+
+ kill() {
+ this.killed = true;
+ return true;
+ }
+
+ /** Feeds one NDJSON line, the way the real helper emits them. */
+ emitEvent(event: Record<string, unknown>) {
+ this.stdout.write(`${JSON.stringify(event)}\n`);
+ }
+}
+
+const spawnMock = vi.mocked(spawn);
+let helper: FakeHelper;
+let originalPlatform: PropertyDescriptor | undefined;
+
+beforeEach(() => {
+ originalPlatform = Object.getOwnPropertyDescriptor(process, "platform");
+ Object.defineProperty(process, "platform", { value: "darwin", configurable: true });
+ helper = new FakeHelper();
+ spawnMock.mockReset();
+ spawnMock.mockReturnValue(helper as unknown as ReturnType<typeof spawn>);
+ mocks.isTrustedAccessibilityClient.mockReset();
+ mocks.isTrustedAccessibilityClient.mockReturnValue(true);
+ const silence = () => {
+ // The access probe logs every helper diagnostic; keep the test output readable.
+ };
+ vi.spyOn(console, "warn").mockImplementation(silence);
+ vi.spyOn(console, "error").mockImplementation(silence);
+});
+
+afterEach(() => {
+ if (originalPlatform) {
+ Object.defineProperty(process, "platform", originalPlatform);
+ }
+ vi.restoreAllMocks();
+});
+
+/** Lets the spawn listeners attach before the fake helper speaks. */
+async function settle<T>(pending: Promise<T>, act: () => void): Promise<T> {
+ await Promise.resolve();
+ act();
+ return pending;
+}
+
+describe("requestMacCursorAccessibilityAccess", () => {
+ it("grants when the helper reports Accessibility trust", async () => {
+ const access = await settle(requestMacCursorAccessibilityAccess(), () =>
+ helper.emitEvent({ type: "ready", timestampMs: 1, accessibilityTrusted: true }),
+ );
+
+ expect(access).toMatchObject({ success: true, granted: true, status: "granted" });
+ });
+
+ it("reports a genuine denial when the helper ran and was told no", async () => {
+ const access = await settle(requestMacCursorAccessibilityAccess(), () =>
+ helper.emitEvent({ type: "ready", timestampMs: 1, accessibilityTrusted: false }),
+ );
+
+ expect(access).toMatchObject({ granted: false, status: "not-determined" });
+ // The ONLY status that should ever raise the "grant Accessibility" dialog.
+ expect(isMacCursorHelperUnavailable(access.status)).toBe(false);
+ });
+
+ /**
+ * The regression test for #515. On macOS 12 the helper was stamped with a macOS 13
+ * deployment target, so it died in the loader before printing its `ready` line — and
+ * the app answered by telling the user to grant a permission they already held.
+ * A helper that never got to ask must never be reported as a denial.
+ */
+ it("does not call a helper that died before ready a denied permission", async () => {
+ const access = await settle(requestMacCursorAccessibilityAccess(), () =>
+ helper.emit("exit", null, "SIGABRT"),
+ );
+
+ expect(access.granted).toBe(false);
+ expect(access.status).toBe("exited");
+ // The app itself IS trusted — proof this is a broken build, not a missing grant.
+ expect(access.accessibilityTrusted).toBe(true);
+ expect(isMacCursorHelperUnavailable(access.status)).toBe(true);
+ });
+
+ it("distinguishes a helper that could not be spawned at all", async () => {
+ const access = await settle(requestMacCursorAccessibilityAccess(), () =>
+ helper.emit("error", new Error("spawn ENOENT")),
+ );
+
+ expect(access).toMatchObject({ granted: false, status: "error" });
+ expect(isMacCursorHelperUnavailable(access.status)).toBe(true);
+ });
+
+ it("distinguishes a helper that hung without ever answering", async () => {
+ vi.useFakeTimers();
+ try {
+ const pending = requestMacCursorAccessibilityAccess();
+ await Promise.resolve();
+ await vi.advanceTimersByTimeAsync(5_000);
+ const access = await pending;
+
+ expect(access).toMatchObject({ granted: false, status: "timeout" });
+ expect(isMacCursorHelperUnavailable(access.status)).toBe(true);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ it("keeps the app's own trust separate from the helper's fate", async () => {
+ mocks.isTrustedAccessibilityClient.mockReturnValue(false);
+
+ const access = await settle(requestMacCursorAccessibilityAccess(), () =>
+ helper.emit("exit", 1, null),
+ );
+
+ expect(access.accessibilityTrusted).toBe(false);
+ expect(access.status).toBe("exited");
+ });
+});
diff --git a/scripts/check-macos-deployment-target.test.mjs b/scripts/check-macos-deployment-target.test.mjs
new file mode 100644
index 000000000..311e0c2d6
--- /dev/null
+++ b/scripts/check-macos-deployment-target.test.mjs
@@ -0,0 +1,70 @@
+// Guards the macOS deployment floor of the native Swift helpers (issue #515).
+//
+// The floor is declared ONCE, package-wide, and SwiftPM offers no per-target
+// override — so it silently governs every executable in the package. That is
+// exactly how the bug happened: b9e21347 set `.macOS(.v13)` when ScreenCaptureKit
+// was the only target, then b2f9afab added `openscreen-macos-cursor-helper`
+// beside it, which needs nothing newer than 10.15 and inherited 13 anyway.
+//
+// The consequence is not cosmetic. At a deployment target >= 13 the linker
+// resolves the Swift Foundation overlay symbols against Foundation.framework and
+// drops /usr/lib/swift/libswiftFoundation.dylib from the load commands; on
+// macOS 12 those symbols live only in that dylib, so the helper dies in the
+// loader before it can speak — which the app then reported to the user as a
+// denied Accessibility grant.
+//
+// A text assertion rather than a build: this has to fail on Linux and Windows CI
+// too, where no Swift toolchain exists. Native ScreenCaptureKit capture still
+// requires macOS 13 — that floor is enforced in Swift by `@available`, and is
+// deliberately NOT this file's business.
+
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { describe, expect, it } from "vitest";
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
+const PACKAGE_SWIFT = path.join(ROOT, "electron", "native", "screencapturekit", "Package.swift");
+
+/** The lowest macOS anything can ship on: Electron 41's own floor. */
+const SUPPORTED_FLOOR = 12;
+
+/**
+ * Reads the major version out of the `platforms:` block, accepting both spellings
+ * SwiftPM allows — `.macOS(.v12)` and `.macOS("12.3")`.
+ */
+function declaredMacOsFloor(source) {
+ const enumMatch = source.match(/\.macOS\(\s*\.v(\d+)(?:_\d+)?\s*\)/);
+ if (enumMatch) {
+ return Number(enumMatch[1]);
+ }
+
+ const stringMatch = source.match(/\.macOS\(\s*"(\d+)(?:\.\d+)*"\s*\)/);
+ return stringMatch ? Number(stringMatch[1]) : null;
+}
+
+describe("macOS native helper deployment target", () => {
+ const source = readFileSync(PACKAGE_SWIFT, "utf8");
+
+ it("declares a floor the shipped app can actually run on", () => {
+ const floor = declaredMacOsFloor(source);
+
+ expect(floor, `no .macOS(...) platform found in ${PACKAGE_SWIFT}`).not.toBeNull();
+ expect(
+ floor,
+ `Package.swift declares macOS ${floor}, above the app's supported floor of ` +
+ `${SUPPORTED_FLOOR}. This block is package-wide and also governs ` +
+ "openscreen-macos-cursor-helper, which needs nothing newer than 10.15. " +
+ "Raising it strands every macOS " +
+ `${SUPPORTED_FLOOR} user: the helper dies in the loader and the app reports ` +
+ "it as a denied Accessibility grant. See issue #515.",
+ ).toBeLessThanOrEqual(SUPPORTED_FLOOR);
+ });
+
+ it("parses both spellings SwiftPM accepts", () => {
+ expect(declaredMacOsFloor("platforms: [ .macOS(.v12) ]")).toBe(12);
+ expect(declaredMacOsFloor("platforms: [ .macOS(.v10_15) ]")).toBe(10);
+ expect(declaredMacOsFloor('platforms: [ .macOS("12.3") ]')).toBe(12);
+ expect(declaredMacOsFloor("platforms: [ .iOS(.v16) ]")).toBeNull();
+ });
+});
diff --git a/website/docs/installation.md b/website/docs/installation.md
index 5d2c7545f..db23078b6 100644
--- a/website/docs/installation.md
+++ b/website/docs/installation.md
@@ -23,7 +23,7 @@ Download the latest installer for your platform from the [download page](/downlo
| | Minimum | Recommended |
|---|---|---|
| **Windows** | Windows 10 version 1903 (build 18362) or later, Intel 8th Gen / AMD Ryzen 2000 series or newer | Windows 11, Intel 12th Gen / AMD Ryzen 4000 series or newer |
-| **macOS** | macOS 12.3 (Monterey) — required by ScreenCaptureKit for native capture | macOS 14 or later |
+| **macOS** | macOS 12 (Monterey); macOS 13 (Ventura) or later for native ScreenCaptureKit capture — on macOS 12 recording falls back to the [browser pipeline](#platform-differences), with fewer capabilities | macOS 14 or later |
| **Linux** | `xdg-desktop-portal` and PipeWire for native capture and system audio (default on Ubuntu 22.04+, Fedora 34+) — recording still works without them through the [browser-capture fallback](#platform-differences), with fewer capabilities. Recording mouse clicks on Wayland additionally needs your user in the `input` group — see [Mouse clicks on Wayland](#mouse-clicks-on-wayland) | Same, kept up to date |
| **RAM** | 8 GB | 16 GB |
@@ -131,7 +131,7 @@ The editing tools are the same everywhere — zooms, backgrounds, crop/trim/spee
| | macOS | Windows | Linux |
|---|---|---|---|
-| Capture pipeline | Native (ScreenCaptureKit) | Native (Windows Graphics Capture) | Browser pipeline |
+| Capture pipeline | Native (ScreenCaptureKit) on macOS 13+; browser pipeline on macOS 12 | Native (Windows Graphics Capture) | Browser pipeline |
| Custom cursor themes / click effects | ✅ | ✅ | ✅ on Wayland — click capture needs the `input` group ([details](#mouse-clicks-on-wayland)) |
| Webcam | Native capture | Native capture | Browser capture (still works as PiP) |
| System audio | macOS 13+; permission prompt on 14.2+; not available on macOS 12 and below | Works out of the box | Needs PipeWire (default on Ubuntu 22.04+, Fedora 34+) |