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:

    screen
  • Start a named session:

    screen -S my_session
  • List existing sessions:

    screen -ls
  • Reattach 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 press d. The session continues running in the background.
  • Create a new window: Press Ctrl + A, then c.
  • Switch to the next window: Press Ctrl + A, then n.
  • Switch to the previous window: Press Ctrl + A, then p.
  • Split window horizontally: Press Ctrl + A, then S.
  • Switch focus between split regions: Press Ctrl + A, then Tab.
  • Kill the current window/session: Type exit in the shell or press Ctrl + A, then k.

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 tmux

Session Management

  • Start an unnamed session:

    tmux
  • Start a named session:

    tmux new -s work_session
  • List active sessions:

    tmux ls
  • Reattach to the last session:

    tmux attach
  • Reattach to a specific session:

    tmux attach -t work_session
  • Kill 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, then d

Pane Management (Splitting the Screen):

  • Split pane horizontally: Ctrl + B, then "
  • Split pane vertically: Ctrl + B, then %
  • Navigate between panes: Ctrl + B, then use the Arrow Keys
  • Close active pane: Ctrl + B, then x (followed by y to confirm), or type exit

Window Management (Tabs within a Session):

  • Create a new window: Ctrl + B, then c
  • Go to the next window: Ctrl + B, then n
  • Go to the previous window: Ctrl + B, then p
  • Select window by number: Ctrl + B, then 0–9
  • List and choose windows interactively: Ctrl + B, then w