# Protect Private Data in Remote Mac Screenshots

Canonical: https://figment.so/blog/mac-agent-screenshot-privacy

Crop every capture with screencapture -R, check that the Screen Recording permission really works with a hashed baseline, and delete screenshots on a schedule. A Figment Intel Mac VM ($25 a month) runs the capture jobs.

Keep private data out of automated screenshots with three habits: capture only the region you need with `screencapture -R`, test that the Screen Recording permission works before you trust a scheduled job, and delete screenshots on a fixed schedule. The `screencapture` tool captures exactly what you point it at, so region discipline, a permission check and a retention policy are your job. A Figment Intel Mac VM ($25 a month) handles region-cropped capture for web dashboards and Intel-compatible apps.

## Which Figment Mac plan should run the capture job?

For web dashboards, Intel-compatible desktop apps and headless browser pipelines, start on the [Intel Mac VM](/mac-hosting#intel-vm): 4 shared vCPUs, 4GB of RAM and an 80GB SSD on macOS Sequoia, at $25 a month, $2 a day or $0.15 an hour. It gives you a remote desktop session and a terminal, and `screencapture` reads that desktop session.

| Target app | Plan | Price |
| --- | --- | --- |
| Web dashboards, Intel-compatible native apps | [Intel Mac VM](/mac-hosting#intel-vm) | $25 a month |
| Apple silicon-only apps, or apps that need Xcode 26.4 or later | [Apple Silicon Mac VM](/mac-hosting#apple-silicon-vm), 4GB RAM, 65GB | $39 a month |
| Heavy rendering, many captures at once, or screenshots you want on a Mac no other customer shares | [Dedicated M4 Pro 48 GB](/mac-hosting#dedicated-m4-pro), M4 Pro, 48GB, 512GB | $349 a month |

If your automation depends on a specific native app, open and test it in the remote desktop session before you wire it into a schedule. Prices are USD before tax.

## How do I grant Screen Recording permission correctly?

Add the process that runs your script to Screen & System Audio Recording in System Settings, then restart that process. macOS gates screen reads through TCC (Transparency, Consent, and Control). A process that calls `screencapture` or ScreenCaptureKit without the permission gets a blank or black frame and no error. See Apple's [Control access to screen and system audio recording on Mac](https://support.apple.com/guide/mac-help/control-access-to-screen-system-audio-recording-mchld6aa7d23/mac). Silent blank capture is the most common failure in automated screenshot pipelines.

1. Open System Settings, Privacy & Security, Screen & System Audio Recording.
2. Add the executable that will run your script (your automation binary, Terminal, or iTerm2).
3. Restart that process after granting, because TCC changes do not apply to already-running processes.

`tccutil` can reset an entry but cannot add one, so plan this step into provisioning and record the exact binary path so the grant survives a rebuild. On a managed fleet, deploy an MDM Privacy Preferences Policy Control payload instead of clicking through the UI.

## How do I test that the permission works?

Display a full-screen page of a known color, capture a small region, and compare its hash with a baseline you captured by hand once.

```bash
#!/usr/bin/env bash
set -euo pipefail

TEST_FILE="$(mktemp -t tcc_check).png"
trap 'rm -f "${TEST_FILE}"' EXIT

# Capture a 4x4 region where you have displayed a known colour page.
screencapture -R 10,10,4,4 -x -t png "${TEST_FILE}"

WIDTH=$(sips -g pixelWidth  "${TEST_FILE}" | awk '/pixelWidth/{print $2}')
HEIGHT=$(sips -g pixelHeight "${TEST_FILE}" | awk '/pixelHeight/{print $2}')
echo "capture ${WIDTH}x${HEIGHT}"

BASELINE="${HOME}/.tcc_baseline.sha256"
HASH=$(shasum -a 256 "${TEST_FILE}" | awk '{print $1}')
if [[ -f "${BASELINE}" ]]; then
  if [[ "${HASH}" == "$(cat "${BASELINE}")" ]]; then
    echo "OK  pixel hash matches baseline"
  else
    echo "FAIL pixel hash mismatch - TCC denied or display changed"
    exit 1
  fi
else
  echo "no baseline; storing current hash"
  echo "${HASH}" > "${BASELINE}"
fi
```

File-size heuristics are unreliable, because a blank PNG can be the same size as a valid one. Use dimensions and a hashed baseline on a controlled region instead. The flags used here are `-R x,y,w,h`, `-x` (no sound) and `-t png`. Confirm their wording in `man screencapture` on your installed version.

## What is the consent, crop and retention procedure?

Apply three phases once per job type, not once per run.

### Phase 1: Consent, before you build the job

| Check | Action |
|---|---|
| Does the target screen contain user PII, credentials or financial data? | Exclude that UI region from capture. If avoidance is impossible, do not capture |
| Who is authorized to view the screenshots? | Define the access list before the first run |
| Is screen capture a documented business requirement? | Record the justification in the runbook |
| Is the machine shared? | Use a dedicated agent account and never run personal sessions on the same desktop |

### Phase 2: Crop, during capture

Use `-R x,y,width,height` to limit `screencapture` to the exact element you need. Never default to full screen in automation.

```bash
#!/usr/bin/env bash
set -euo pipefail

# Capture only the status indicator at top-right (example coordinates).
# Measure with Accessibility Inspector or screencapture -i once.
CAPTURE_REGION="1400,24,480,36"
OUTPUT_DIR="${HOME}/screenshots/$(date -u +%Y-%m-%d)"
OUTPUT_FILE="${OUTPUT_DIR}/status-$(date -u +%H%M%S).png"

mkdir -p "${OUTPUT_DIR}"
screencapture -R "${CAPTURE_REGION}" -x -t png "${OUTPUT_FILE}"

echo "captured: ${OUTPUT_FILE}"
echo "sha256:   $(shasum -a 256 "${OUTPUT_FILE}" | awk '{print $1}')"
```

Define `CAPTURE_REGION` as a named constant, comment the UI element it targets, and require code review when the value changes. `-t png` produces lossless output, so text stays legible for evidence captures.

### Phase 3: Retention

| Retention rule | Recommended default |
|---|---|
| Maximum age before deletion | 7 days (adjust to your compliance requirement) |
| Storage location | Private bucket or volume, not a shared CI artifact store |
| Encryption at rest | Required if screenshots may contain personal data |
| Access log | Record each read next to the job receipt |

Enforce the maximum age with a scheduled launchd job. Apple's [Creating Launch Daemons and Agents](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html) documents `ProgramArguments` and `StartCalendarInterval` for a daily run:

```xml
<key>ProgramArguments</key>
<array>
  <string>/bin/bash</string>
  <string>-c</string>
  <string>find /Users/agent/screenshots -mtime +7 -name "*.png" -delete</string>
</array>
<key>StartCalendarInterval</key>
<dict>
  <key>Hour</key><integer>2</integer>
  <key>Minute</key><integer>0</integer>
</dict>
```

## What failures should I watch for?

**Blank images.** `screencapture` can exit 0 and still produce a blank frame when TCC is denied or the display is locked. Run the hash check on each cycle. If it fails, alert the owner and skip the downstream steps instead of uploading a black image as evidence.

**Drifted coordinates.** A macOS or app update can shift element positions. After any upgrade, drop the schedule to once a day for a week and spot-check the crops before returning to the normal cadence.

**Unexpected content.** Popovers, autocomplete dropdowns and notification banners can cover a carefully chosen region. Compare the pixel entropy of the captured region with a baseline and flag sharp deviations for human review before storage.

## How much disk do screenshots use?

Region crops are small, and full-frame captures add up. A 480x36 PNG is roughly 15 KB, so 1,000 captures a day is about 15 MB. A full 1080p PNG is 1 to 3 MB, so one full-frame capture a minute is 1.4 to 4.3 GB a day. These are approximate sizes, not measurements. The Intel VM's 80GB SSD includes the OS, so size the region and the schedule before you size the disk. Figment does not back up your Mac, so keep your own archive with an access list and a retention rule.

## How do I start or migrate the workload?

When you migrate from a local Mac, copy your capture scripts, re-measure the crop coordinates on the hosted display resolution, grant Screen Recording to the exact binary you will run, and trigger one manual `launchctl start` before you enable the schedule. For a new build, pick a plan from the [Mac hosting plans](/mac-hosting), run the TCC baseline test, and add the retention job on day one so no screenshot is kept without a deletion date.

---

**Related guides:**  
[App crash recovery on a hosted Mac](/blog/mac-agent-app-crash-recovery) · [Disk pressure on a hosted Mac agent](/blog/mac-agent-disk-pressure) · [GitHub Actions self-hosted runner on Mac](/blog/mac-github-actions-self-hosted-runner)
