# Resetting TCC Permissions Between macOS Test Runs

Canonical: https://figment.so/blog/mac-tcc-database-reset-test-runs

Before each macOS test run, call tccutil reset for exactly the services your disposable test bundle uses, then confirm the system prompt appears again at the next launch. Never treat TCC.db contents as proof.

**Between each macOS test run, call `tccutil reset <Service> <bundleID>` for exactly the privacy services your test bundle uses, then verify by observing the next launch: the system permission alert must appear again.** Do not read `TCC.db` directly as proof, because the schema, service list and file location are private to Apple and have changed between releases. Scope every reset to one disposable test bundle ID under the current user.

If your test suite depends on a first-run permission dialog (camera, microphone, contacts, calendar, reminders, photos), a leftover grant from an earlier run skips the alert and quietly changes which branch of the test runs. The fix is a small, supported pre-step: targeted `tccutil reset` calls for one bundle ID, followed by a visible fresh-prompt check for each service you care about.

## What does tccutil reset do, and what doesn't it do?

It clears the stored decision for one service and one bundle ID, and nothing else. Apple's Transparency, Consent and Control (TCC) subsystem records user privacy decisions, and `tccutil` is the one supported command-line surface for clearing them. Its local man page documents a single verb, `reset`, with the form `tccutil reset <service> [<bundle-id>]`. Read it on your own machine before trusting any blog table of service keys:

```bash
man tccutil
```

On a current, SIP-enabled macOS, `tccutil reset <Service> <bundleID>` does this reliably:

- Clears the user's prior decision for that one service and one bundle ID.
- Causes the system to re-prompt the next time that app requests the service.
- Runs without `sudo` for user-scope services the current user already owns.

It does **not** do these things:

- It does not *grant* permission. Only the user tapping Allow at the live prompt does that. A Mobile Device Management Privacy Preferences Policy Control (PPPC) profile can grant some services (for example Apple Events, Accessibility, SystemPolicyAllFiles), but Apple's deployment guide is explicit that Camera, Microphone and Screen Recording can be *denied* by PPPC and *cannot* be set to Allowed by any MDM. The user still taps Allow in person. See the Apple Platform Deployment entry on the [Privacy Preferences Policy Control payload](https://support.apple.com/guide/deployment/privacy-preferences-policy-control-payload-dep38df53c2a/web).
- It is not a universal catalog. The man page notes that the full service list "will vary with the software currently installed." Confirm the exact spelling (`Camera`, `Microphone`, `ScreenCapture`, `Accessibility`, `AddressBook`, `Calendar`, `Reminders`, `Photos`, `SystemPolicyAllFiles`, `SpeechRecognition`, …) on the macOS release you target.
- Running as root does not automatically grant anything. Supported reset scope depends on the macOS version and service, so verify the resulting permission state in the tested user session.
- Reading or writing `TCC.db` directly is unsupported. Treat the SQLite file as an implementation detail that may move, change schema, be sealed by SIP, or require Full Disk Access to open. "Zero rows in `access`" is not a reliable success signal. A visible fresh prompt at next launch is.

Skip the broad `tccutil reset All` and the `All` with no bundle forms. They touch more than the suite under test and leave you debugging state you did not intend to change. A targeted reset per service per bundle is the only form this article recommends.

## What does the targeted reset script look like?

Save this as `scripts/tcc-reset.sh`. It runs on the macOS default shell (Bash 3.2), targets one bundle ID, resets only the services you list, and leaves a human-readable audit line per call. It has no `declare -A` (Bash 4 only), no `sudo`, no identity switching and no `TCC.db` query.

```bash
#!/bin/bash
# tcc-reset.sh — reset TCC services for one test bundle (Bash 3.2 compatible)
# Usage: scripts/tcc-reset.sh com.example.yourtestapp [audit.log]
set -eu

BUNDLE_ID="${1:?Usage: $0 <bundle-id> [audit-log]}"
AUDIT_LOG="${2:-reset-audit.log}"

# Edit this list to the services your test bundle actually uses.
# Confirm names against `man tccutil` on your target macOS version.
SERVICES="Camera Microphone AddressBook Calendar Reminders Photos SpeechRecognition"

: > "$AUDIT_LOG"
printf '=== tcc-reset %s @ %s ===\n' \
  "$BUNDLE_ID" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" | tee -a "$AUDIT_LOG"

for svc in $SERVICES; do
  ts=$(date -u +%H:%M:%SZ)
  if tccutil reset "$svc" "$BUNDLE_ID" >>"$AUDIT_LOG" 2>&1; then
    printf '[%s] %-20s OK\n' "$ts" "$svc" | tee -a "$AUDIT_LOG"
  else
    printf '[%s] %-20s FAIL (unknown service on this macOS?)\n' \
      "$ts" "$svc" | tee -a "$AUDIT_LOG"
    exit 1
  fi
done

printf '=== reset complete; verify each service with a fresh-prompt check ===\n' \
  | tee -a "$AUDIT_LOG"
```

This is an untested example. Run it once by hand on your macOS target, confirm each service name is accepted on that release, then wire it in. Use a *disposable* test bundle ID, not the production app identifier, so a failed reset never corrupts a developer's own permission state.

## How do I verify that the reset worked?

Check that the system prompt appears again at the next launch, because that is the only honest proof. Keep this matrix next to the suite and tick each row during a dry run:

| Service (tccutil arg) | Trigger in the test app | Expected after reset |
|---|---|---|
| `Camera` | `AVCaptureDevice.requestAccess(for: .video)` | System dialog shown |
| `Microphone` | `AVCaptureDevice.requestAccess(for: .audio)` | System dialog shown |
| `AddressBook` | `CNContactStore.requestAccess` | System dialog shown |
| `Calendar` | `EKEventStore.requestFullAccessToEvents` | System dialog shown |
| `Reminders` | `EKEventStore.requestFullAccessToReminders` | System dialog shown |
| `Photos` | `PHPhotoLibrary.requestAuthorization` | System dialog shown |
| `SpeechRecognition` | `SFSpeechRecognizer.requestAuthorization` | System dialog shown |

If a row stays silent, the reset did not take effect for that service on that macOS version. Re-check the exact service name in `man tccutil`, confirm the running process is your test bundle, and quit and relaunch. TCC caches the decision in-process, so a long-running app can keep acting on a stale answer.

## How do I run the reset in GitHub Actions and Xcode Cloud?

**GitHub Actions self-hosted macOS runner.** Call the script from the job and upload the audit log, so each build keeps a record of which services were reset:

```yaml
- name: Reset TCC for test bundle
  env:
    BUNDLE_ID: com.example.yourtestapp
  run: |
    chmod +x scripts/tcc-reset.sh
    scripts/tcc-reset.sh "$BUNDLE_ID" reset-audit.log

- uses: actions/upload-artifact@v4
  if: always()
  with:
    name: tcc-reset-audit
    path: reset-audit.log
```

Self-hosted runners do not get the clean-VM guarantee of GitHub-hosted runners, so permission state can survive between jobs. GitHub's current [hardening guidance for self-hosted runners](https://docs.github.com/en/actions/reference/security/secure-use#hardening-for-self-hosted-runners) recommends ephemeral just-in-time runners and tight access control. Pair that posture with the reset step so the suite starts from a known state even on a long-lived runner.

**Xcode Cloud.** Xcode Cloud reads its custom build scripts from a `ci_scripts/` folder at the repository root, not from the repo root itself. Create `ci_scripts/ci_pre_xcodebuild.sh`, mark it executable, and invoke the reset script from there:

```bash
#!/bin/sh
# ci_scripts/ci_pre_xcodebuild.sh
set -eu
"$CI_WORKSPACE/scripts/tcc-reset.sh" "com.example.yourtestapp" \
  "$CI_DERIVED_DATA_PATH/reset-audit.log"
```

Xcode Cloud runs on Apple-managed hosts, and privacy prompts outside the simulator cannot be answered interactively there. Keep tests that require a live Allow tap on a Mac you own or rent, and use simulator-driven paths for the hosted service.

## Can every plan run the TCC reset flow?

Any Figment Mac plan works for the reset flow, because you have administrator access to your own Mac or VM and the reset runs in your own user session. The Intel Mac VM ($25 a month, $2 a day) runs macOS Sequoia with Xcode 26.3 or earlier. The Apple Silicon Mac VM ($39 a month, $6 a day) fits Xcode 26.4 or later. The Dedicated M4 Pro ($349 a month, or $299 a month on a 12-month term) is a whole Mac, which suits a long-lived runner whose permission state you want to control completely.

Camera, microphone and other capture hardware are not available or measured on any Figment plan, so tests that need live hardware capture belong on a physical Mac you control. We have not measured these prompts on any plan, so run the verification matrix once on the machine you pick. Testing several macOS versions needs one Mac or VM per version, with the version shown before purchase. See the [Mac hosting plans](/mac-hosting).

**Related guides:**

- [Self-hosted GitHub Actions runner on macOS](/blog/mac-github-actions-self-hosted-runner)
- [Microphone entitlement test scripting](/blog/mac-microphone-entitlement-test-script)
- [Safari private browsing storage test](/blog/mac-safari-private-browsing-storage-test)
