# Record a Remote Mac Session for Audit Trails

Canonical: https://figment.so/blog/mac-remote-session-screen-recording

Run ffmpeg from an admin-owned LaunchAgent so recording starts at login, stops at logout, and writes UTC-stamped files outside the session user's home folder. Figment has not published session recording of its own.

**Pair `ffmpeg` with an admin-owned LaunchAgent so recording starts at login, stops at logout, and lands in a folder the session user cannot delete from.** Files get ISO 8601 UTC names, so you can answer "what did they do?" for incident review, billing disputes and compliance evidence of privileged access. Figment has not published session recording of its own, so this recipe uses macOS and ffmpeg on your own Mac or VM, where you have administrator access.

## Why record contractor sessions?

Recording gives you a verifiable answer when a contractor or support technician logs into a Mac you are responsible for.

1. **Incident review.** If a contractor deletes or modifies the wrong files, you can establish when it happened and what preceded it.
2. **Billing disputes.** Hourly contractors and support vendors sometimes bill for time that is hard to verify later. Timestamped recordings confirm active screen time.
3. **Regulated access evidence.** Financial services, healthcare and government-contract environments often require documented evidence of privileged access activity.

macOS already produces screen recordings as `.mov` files on demand with Shift-Command-5 ([Apple Support: Take screenshots or screen recordings](https://support.apple.com/guide/mac-help/take-screenshots-or-screen-recordings-mh26782/mac)). That suits one-off captures but not compliance, because the session user controls when it starts and stops and the output lands on their Desktop. The LaunchAgent approach takes that control away from the session user.

## How do I prepare the recording folder and ffmpeg?

Install ffmpeg once as an admin:

```bash
brew install ffmpeg
```

Create the recordings directory outside any session user's home folder. The sticky bit lets each user write files, but only the owner or root can delete them, so a session user cannot erase a recording that captured them:

```bash
sudo mkdir -p /var/session-recordings
sudo chmod 1777 /var/session-recordings
# 1777 = sticky bit + rwx for all. Any user can create files;
# only the owner or root can delete them.
```

Confirm the AVFoundation screen index, which varies by machine:

```bash
ffmpeg -f avfoundation -list_devices true -i "" 2>&1 \
  | grep -A20 "AVFoundation video"
# Look for a line like: [1] Capture screen 0
# Record that index; the LaunchAgent below uses it.
```

Then grant **System Settings → Privacy & Security → Screen Recording** permission to the binary that runs ffmpeg (typically `/opt/homebrew/bin/ffmpeg` on Apple silicon, `/usr/local/bin/ffmpeg` on Intel). Without it, ffmpeg writes black frames and logs a permission error.

## How do I start recording at login with a LaunchAgent?

Place the plist in `/Library/LaunchAgents/`. Apple documents this as the global-per-user agent location: launchd starts these agents for every user that logs in and sends `SIGTERM` to them when that user logs out ([Apple Developer: Creating Launchd Jobs](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html)). Because the directory is admin-owned, the session user cannot unload or edit the job, and `SIGTERM` gives ffmpeg a chance to flush the trailing frames and finalise the MP4 container.

**Step 1: wrapper script** (`/usr/local/bin/start-session-recording.sh`):

```bash
#!/bin/bash
# Started by launchd at user login. Stopped by SIGTERM at logout.
set -euo pipefail

RECORDINGS_DIR="/var/session-recordings"
if [[ ! -d "${RECORDINGS_DIR}" ]]; then
  echo "ERROR: ${RECORDINGS_DIR} missing. Admin must create it." >&2
  exit 1
fi

SCREEN_INDEX="1"   # from the list_devices step above
TIMESTAMP=$(date -u +%Y%m%dT%H%M%SZ)
OUTFILE="${RECORDINGS_DIR}/session-${USER}-${TIMESTAMP}.mp4"

exec ffmpeg \
  -f avfoundation \
  -r 10 \
  -i "${SCREEN_INDEX}:" \
  -vcodec libx264 \
  -preset ultrafast \
  -crf 30 \
  -pix_fmt yuv420p \
  "${OUTFILE}"
```

Make it executable: `sudo chmod +x /usr/local/bin/start-session-recording.sh`.

**Step 2: LaunchAgent plist** at `/Library/LaunchAgents/com.company.session-recorder.plist`:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.company.session-recorder</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/start-session-recording.sh</string>
  </array>
  <key>RunAtLoad</key><true/>
  <key>KeepAlive</key><false/>
  <key>StandardOutPath</key>
  <string>/var/session-recordings/launchd-recorder.log</string>
  <key>StandardErrorPath</key>
  <string>/var/session-recordings/launchd-recorder-err.log</string>
</dict>
</plist>
```

Set ownership and load it:

```bash
sudo chown root:wheel /Library/LaunchAgents/com.company.session-recorder.plist
sudo chmod 644 /Library/LaunchAgents/com.company.session-recorder.plist
launchctl load /Library/LaunchAgents/com.company.session-recorder.plist
```

**Encoding settings you may want to change.** `-r 10` keeps keyboard and mouse activity legible while cutting file size. `-crf 30` controls quality (28 to 32 is a reasonable audit band, lower is sharper and larger). `-preset ultrafast` keeps CPU off the contractor's workload. Treat file sizes as your own measurement and test one real session before you rely on a number.

**SIGTERM caveat.** ffmpeg generally finalises the MP4 when it receives `SIGTERM`, but not if the Mac is powered off abruptly or the process receives `SIGKILL`. Log out mid-recording once and play the file back end to end before you treat the pipeline as production.

## How should I name, keep and move the files?

Files land with ISO 8601 UTC names, which sort chronologically in any listing and avoid timezone ambiguity:

```
/var/session-recordings/session-contractor42-20261110T143022Z.mp4
/var/session-recordings/session-contractor42-20261112T091500Z.mp4
```

Prune on a schedule with `find`, run from a LaunchDaemon or admin cron:

```bash
find /var/session-recordings -name "session-*.mp4" -mtime +90 -delete
```

For long-term archives, push completed files off the Mac each day. A recording on the Mac is not a backup, and Figment does not back up your Mac. `rsync` to an SFTP target or `rclone` to an S3-compatible bucket both work:

```bash
rsync -avz --remove-source-files \
  /var/session-recordings/ \
  audit@audit-server.example.com:/mac-recordings/
```

Protect the destination with a key that only the admin account can read, so the recordings end up somewhere the contractor's account cannot reach.

## What privacy and disclosure rules apply?

Recording a user's screen without disclosure creates legal and HR exposure that varies by jurisdiction. Before you deploy:

- State in writing, in the employment contract, service agreement or acceptable-use policy, that sessions on company equipment may be recorded.
- Confirm employment and data-protection rules for your location and the contractor's location. Some require explicit consent and others accept notice.
- Restrict read access on the recordings folder and archive bucket to the admin account, and treat the files like other HR-sensitive records.
- Commit to a written retention and deletion window, and do not keep recordings indefinitely by default.

## How much CPU headroom does session recording need?

Any plan works, because you have administrator access to your own Mac or VM. The recording itself needs CPU headroom, so the [Apple Silicon Mac VM](/mac-hosting#apple-silicon-vm) ($39 a month) or the [Dedicated M4 Pro 48 GB](/mac-hosting#dedicated-m4-pro) ($349 a month) is the safer choice if the contractor also builds on the same Mac. Figment has not measured screen-recording load on any plan, so test one real session. See [Mac hosting plans](/mac-hosting).

## What else should I read?

- [Two-factor authentication for remote Mac sessions](/blog/mac-remote-desktop-two-factor-auth)
- [Remote Mac clipboard sync](/blog/mac-remote-desktop-clipboard-sync)
- [Mac GitHub Actions self-hosted runner](/blog/mac-github-actions-self-hosted-runner)
