| name | apple-notes-debug-bundle |
| description | Collect Apple Notes automation debug evidence for troubleshooting.
Trigger: "apple notes debug".
|
| allowed-tools | Read, Write, Edit, Bash(osascript:*), Grep |
| version | 1.6.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","macos","apple-notes","automation"] |
| compatibility | Designed for Claude Code |
Apple Notes Debug Bundle
Overview
This debug bundle collects diagnostic information from Apple Notes automation integrations
for troubleshooting AppleScript and JXA (JavaScript for Automation) workflows. It captures
macOS version compatibility, Notes.app account configuration, folder and note counts,
TCC (Transparency, Consent, and Control) permission status, and Shortcuts automation
entitlements. The resulting tarball helps diagnose permission denials, sandbox restrictions,
iCloud sync failures, and scripting bridge errors that commonly block Notes automation.
Prerequisites
- macOS 12+ with Notes.app configured
osascript, tar available (built into macOS)
- Terminal granted Automation permission for Notes.app in System Preferences > Privacy & Security
Debug Collection Script
#!/bin/bash
set -euo pipefail
BUNDLE="debug-apple-notes-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$BUNDLE"
echo "=== Environment ===" > "$BUNDLE/environment.txt"
echo "macOS: $(sw_vers -productVersion 2>/dev/null || echo 'not macOS')" >> "$BUNDLE/environment.txt"
echo "Notes.app running: $(pgrep -x Notes > /dev/null && echo Yes || echo No)" >> "$BUNDLE/environment.txt"
echo "Shell: $SHELL ($TERM)" >> "$BUNDLE/environment.txt"
echo "Timestamp: $(date -u)" >> "$BUNDLE/environment.txt"
echo "=== TCC Permissions ===" > "$BUNDLE/tcc-status.txt"
sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db \
"SELECT client, auth_value, auth_reason FROM access WHERE service='kTCCServiceAppleEvents'" \
>> "$BUNDLE/tcc-status.txt" 2>/dev/null || echo "Cannot read TCC database (SIP may block)" >> "$BUNDLE/tcc-status.txt"
echo "=== Accounts ===" >
osascript -l JavaScript -e >> 2>&1 || >>
>
osascript -l JavaScript -e >> 2>&1 || >>
>
shortcuts list 2>/dev/null | grep -i note >> || >>
>
brctl status com.apple.Notes 2>/dev/null >> || >>
-la ~/Library/Group\ Containers/group.com.apple.notes/ >> 2>/dev/null || >>
>
show --predicate --last 30m --style compact 2>/dev/null \
| -50 >> || >>
tar -czf && -rf
Analyzing the Bundle
tar -xzf debug-apple-notes-*.tar.gz
cat debug-apple-notes-*/environment.txt
cat debug-apple-notes-*/tcc-status.txt
cat debug-apple-notes-*/accounts.txt
cat debug-apple-notes-*/console-errors.txt
Common Issues
| Symptom | Check in Bundle | Fix |
|---|
-1743 error (not permitted) | tcc-status.txt shows no entry for Terminal | Grant Automation permission: System Settings > Privacy > Automation > Terminal > Notes |
| JXA returns empty arrays | accounts.txt shows 0 notes | Notes.app must be open at least once; launch Notes and wait for iCloud sync |
execution error: Notes got an error: AppleEvent timed out | console-errors.txt shows timeout | Notes.app is busy syncing; wait for iCloud sync to finish, then retry |
| Folder query fails on shared accounts | folders.txt shows error on non-default account | Specify account explicitly: app.accounts.byName("iCloud") |
| Shortcuts integration returns empty | shortcuts.txt shows no matches | Create a Notes shortcut manually in Shortcuts.app, then re-run |
brctl reports conflict | icloud-sync.txt shows conflict state | Open Notes.app, resolve duplicate notes, then force sync via iCloud preferences |
Automated Health Check
import { execSync } from "child_process";
function checkAppleNotesHealth(): {
status: string;
macosVersion: string;
notesRunning: boolean;
accountCount: number;
tccGranted: boolean;
} {
const macosVersion = execSync("sw_vers -productVersion").toString().trim();
const notesRunning = execSync("pgrep -x Notes || true").toString().trim() !== "";
let accountCount = 0;
try {
const raw = execSync(
'osascript -l JavaScript -e \'Application("Notes").accounts().length\''
).toString().trim();
accountCount = parseInt(raw, 10);
} catch { }
const tccGranted = accountCount > 0;
return {
status: tccGranted && notesRunning ? "healthy" : "degraded",
macosVersion,
notesRunning,
accountCount,
tccGranted,
};
}
Resources
Next Steps
See apple-notes-rate-limits.