Friendly, passive Apple Terminal history harvesting for macOS.
It writes the maximum recoverable content from Apple Terminal into one capped JSONL file at ~/.terminal_global_history.jsonl without changing Terminal's shell launch chain.
This is meant for people who sometimes need to analyze past work, retrace steps, or backtrack on one of those bad days when you really need to understand what happened.
If people are interested, an optional encryption layer tied to Apple user-level auth can be added later so the log stays more protected without changing the overall workflow.
- Live scrollback from open Apple Terminal tabs via AppleScript.
- Durable Apple-managed session artifacts from
~/.zsh_sessions.
- It does not wrap your shell.
- It does not disable Apple Terminal session restore.
- It does not disable Apple per-session history.
- It does not guarantee a mathematically perfect full transcript.
- Download this Gist or clone it.
- From the folder containing these files, run:
zsh install.sh- When prompted, check
Terminal > Settings > Profiles > Red Sands 1 > Window. If scrollback is already set tomemory available, keep it. Otherwise, use the highest scrollback setting you are comfortable with for better live capture.
- Backs up your current Terminal preferences to
~/.terminal-global-log/backups/com.apple.Terminal.before-install.plist - Compiles the Swift collector into
~/.terminal-global-log/bin/terminal-global-log - Copies the AppleScript helper and uninstall script into
~/.terminal-global-log/scripts - Creates
~/Library/LaunchAgents/com.thedawgctor.terminal-global-log.plist - Runs one initial collection pass
- Loads a LaunchAgent that runs at login, every 30 minutes, and when
~/.zsh_sessionschanges
- Canonical log:
~/.terminal_global_history.jsonl - Collector state:
~/.terminal-global-log/state/collector-state.json - LaunchAgent:
~/Library/LaunchAgents/com.thedawgctor.terminal-global-log.plist - Restore instructions:
~/.terminal-global-log/RESTORE.txt
zsh ~/.terminal-global-log/scripts/uninstall.shIf you also want your prior Terminal preferences back, run the defaults import command printed by the uninstall script.
TERMINAL_GLOBAL_LOG_SKIP_DIALOG=1skips the reminder dialog.TERMINAL_GLOBAL_LOG_SKIP_LAUNCHCTL=1skips loading the LaunchAgent.TERMINAL_GLOBAL_LOG_SOURCE_ROOT=/path/to/this/folderoverrides the source folder used byinstall.sh.
If you have gh authenticated, you can publish this folder directly:
zsh publish-gist.sh --publicOr keep it unlisted:
zsh publish-gist.sh --secret