Last active
August 8, 2026 11:13
-
-
Save backroot/45eb242ba4d4cac2c03dfc06a07576c0 to your computer and use it in GitHub Desktop.
Timestamped tmux logging for macOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ----------------------------------------------------------------------------- | |
| # Timestamped tmux logging for macOS | |
| # | |
| # Tested with: | |
| # - macOS 26.5.2 | |
| # - tmux 3.7b | |
| # | |
| # Requirements: | |
| # mkdir -p ~/tmux-logs | |
| # brew install moreutils | |
| # | |
| # Note: | |
| # - The log may contain ANSI escape sequences and control characters because | |
| # tmux captures the raw pane output. | |
| # | |
| # Logging example: | |
| # [2026-08-08 13:17:02] ^[[1m...user@hostname ~ % echo "Hello" ... | |
| # [2026-08-08 13:17:02] Hello | |
| # | |
| # Usage: | |
| # ----------------------------------------------------------------------------- | |
| mkdir -p ~/tmux-logs | |
| brew install moreutils | |
| tmux | |
| tmux pipe-pane -o \ | |
| 'ts "[%Y-%m-%d %H:%M:%S]" >> ~/tmux-logs/#{session_name}-$(date +%F).log' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment