A launchd agent that auto-prunes stale Cursor log directories on macOS.
Cursor writes logs into ~/Library/Application Support/Cursor/logs/ — one
date-stamped subdirectory per session — and never cleans them up. Left alone,
the directory can accumulate tens or hundreds of GB and fill the disk.
The files hold no useful state; deleting them is safe (Cursor recreates the directory on next launch).
Runs daily at 3 AM and removes any top-level session directory older than 7 days:
find "$HOME/Library/Application Support/Cursor/logs" \
-mindepth 1 -maxdepth 1 -type d -mtime +7 \
-exec rm -rf {} +cp com.user.cursor-logs-prune.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.user.cursor-logs-prune.plistlaunchctl list | grep cursor-logs-pruneDry run:
find "$HOME/Library/Application Support/Cursor/logs" \
-mindepth 1 -maxdepth 1 -type d -mtime +7Run output: /tmp/cursor-logs-prune.log.
launchctl unload ~/Library/LaunchAgents/com.user.cursor-logs-prune.plist