- Start a new tmux named session
tmux new -s terminal-capture
- Split the screen using these commands,
- vertical split
<C-b>"
- horizontal split
<C-b>%
- To navigate between the panes,
- To goto Left pane
<C-b> left-key
- To goto Right pane
<C-b> right-key
- To goto Top pane
<C-b> up-key
- To goto Down pane
<C-b> down-key
- Detach the session
tmux <C-b>+d
- Record the tmux session with asciinema
asciinema rec -c "tmux attach -t terminal-capture"
- Detach the tmux session, save the recording and convert it into gif
- Enjoy !!!
This was really helpful. To clarify,
C-b
meansCtrl-b
(even on Mac). And step 6, "Detach the tmux session" - you can pressCtrl-b d
again and it will stop the recording; you don't need to exit tmux.Also I found there is a bug with iTerm2 where it doesn't render anything except the first frame of recordings, after you've made a tmux recording. But if you exit the shell and start a new one it plays fine. Anyway I recommend using Apple's Terminal app for this rather than iTerm2.