How to Use tmux and Screen on macOS 13
Terminal multiplexers allow you to run multiple persistent shell
sessions, split your terminal window into multiple panes, and detach
from active tasks without terminating them. On macOS 13 (Ventura), you
can use the built-in screen utility or install the modern
and widely adopted tmux via Homebrew. This guide covers how
to set up, start, and manage terminal sessions using both tools within
the default macOS Terminal application.
Using GNU Screen
macOS 13 includes GNU Screen by default. It requires no installation and is ideal for quick tasks where you need background persistence.
Basic Commands
Start a new session:
screenStart a named session:
screen -S my_sessionList existing sessions:
screen -lsReattach to a detached session:
screen -r my_session
In-Session Keybindings
All default Screen commands begin with the prefix
Ctrl + A:
- Detach session: Press
Ctrl + A, release, then pressd. The session continues running in the background. - Create a new window: Press
Ctrl + A, thenc. - Switch to the next window: Press
Ctrl + A, thenn. - Switch to the previous window: Press
Ctrl + A, thenp. - Split window horizontally: Press
Ctrl + A, thenS. - Switch focus between split regions: Press
Ctrl + A, thenTab. - Kill the current window/session: Type
exitin the shell or pressCtrl + A, thenk.
Installing and Using tmux
tmux is more customizable and actively maintained than
screen, offering advanced window and pane management. It
does not come pre-installed on macOS, so it must be installed using
Homebrew.
Installation
Run the following command in Terminal:
brew install tmuxSession Management
Start an unnamed session:
tmuxStart a named session:
tmux new -s work_sessionList active sessions:
tmux lsReattach to the last session:
tmux attachReattach to a specific session:
tmux attach -t work_sessionKill a session:
tmux kill-session -t work_session
In-Session Keybindings
All default tmux shortcuts require pressing the prefix
Ctrl + B first, releasing it, and then pressing the desired
key.
Session Control:
- Detach:
Ctrl + B, thend
Pane Management (Splitting the Screen):
- Split pane horizontally:
Ctrl + B, then" - Split pane vertically:
Ctrl + B, then% - Navigate between panes:
Ctrl + B, then use theArrow Keys - Close active pane:
Ctrl + B, thenx(followed byyto confirm), or typeexit
Window Management (Tabs within a Session):
- Create a new window:
Ctrl + B, thenc - Go to the next window:
Ctrl + B, thenn - Go to the previous window:
Ctrl + B, thenp - Select window by number:
Ctrl + B, then0–9 - List and choose windows interactively:
Ctrl + B, thenw