Keyboard Shortcuts for tm on Mac: Master tmux Essentials
Learn the essential keyboard shortcuts for tmux on macOS. This guide covers the default prefix, pane and window management, session basics, and customization ideas from Shortcuts Lib to speed up your workflow.
Master the core keyboard shortcut for tm on Mac: the prefix is Ctrl+b. After pressing it, use single-letter commands to manage windows and panes (e.g., c to create a window, % and " to split, and arrow keys to navigate). If Ctrl+b is intercepted by your terminal, adjust settings or remap the prefix in ~/.tmux.conf. Shortcuts Lib outlines practical basics for a productive tmux workflow.
Understanding tmux on Mac and the default prefix
On Mac, tmux runs inside Terminal.app or iTerm2. The essential concept for speed is the prefix key. The default prefix is Ctrl+b, often written as C-b. After pressing Ctrl+b, tmux awaits a second key to complete the command. This simple model powers hundreds of keyboard shortcuts for windows and panes, making it worth investing time to learn. Open a blank session and practice a few commands to feel how state persists across splits:
# Start a new session named 'dev'
tmux new-session -s dev# List active sessions
tmux ls# Attach to a session named 'dev'
tmux attach -t devIf you’re on macOS and your terminal intercepts the Ctrl+b prefix, review Terminal/iTerm2 settings or consider customizing the prefix in ~/.tmux.conf later in this guide.
markdownVersionedFlag$:true},
The core prefix: Ctrl+b and immediate commands
After pressing the prefix, you trigger single-letter commands (or longer sequences). The most common operations are to create windows, split panes, and navigate. The following commands assume you are already inside a tmux session. For readability, we show both the long command form and the keystroke form.
# Create a new window
tmux new-window# Split pane vertically
tmux split-window -h# Split pane horizontally
tmux split-window -v# Detach from the current session
tmux detachTo move focus between panes, use these commands:
# Move focus left
tmux select-pane -L
# Move focus right
tmux select-pane -R
# Move focus up
tmux select-pane -U
# Move focus down
tmux select-pane -DTo switch windows:
# Go to the next window
tmux next-window
# Go to the previous window
tmux previous-window
```, Window and pane management: creating, navigating, and layouts
tmux supports various layouts to arrange windows and panes. After prefix, you can quickly balance panes and switch layouts without rewriting commands. The examples below illustrate common tasks and how tmux maintains state as you move between tasks. You can combine splits with window navigation to keep multiple tasks visible at once:
# Show all windows in the current session
tmux list-windows# Balance panes into a tiled layout
tmux select-layout tiled# Resize the active pane (left by 5 columns)
tmux resize-pane -L 5# Resize the active pane (down by 3 lines)
tmux resize-pane -D 3Customizing the prefix and config for Mac users
While Ctrl+b is the default, you can customize the prefix to better fit your workflow. This is especially helpful if you rely on macOS keyboard shortcuts that conflict with your tmux prefix. The config file lives at ~/.tmux.conf. The example below shows changing the prefix to Ctrl+a (as used by older systems) and reloading without restarting:
# ~/.tmux.conf
set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefixTo apply changes immediately:
# Reload the config without restarting tmux
tmux source-file ~/.tmux.confSession persistence: detach, attach, and workflows
One of tmux's biggest advantages is session persistence. Detach from a session and leave all work running, then reattach later from the same or a different terminal. This is especially useful on remote machines or during long-running tasks. Practice the lifecycle below:
# Start a named session
tmux new-session -s work# Detach from the session (keyboard)
Ctrl+b d# Reattach to the session
tmux attach -t workPractical workflow and speed tips
In daily use, adopt a small, consistent workflow. A typical Mac tmux session keeps an Editor window, a Shell pane, and a Logs pane. Use copy-mode to grab text from logs and a stable layout to reduce cognitive load. The example below bootstraps a compact setup you can copy-paste into your shell:
# Start a three-pane workflow: Editor, Shell, Logs
tmux new-session -s project -n Editor
tmux split-window -h# Move focus to the left pane and run a command
tmux select-pane -L# Enter copy mode to capture logs
Ctrl+b [In copy mode, navigate using Vi-style keys if enabled, and press Enter to copy a selection.
blockVersionedFlag$:true}],
prerequisites
items
:[{item:
Steps
Estimated time: 30-45 minutes
- 1
Install tmux on Mac
Install tmux via Homebrew or your preferred package manager. Verify the installation with tmux -V and ensure the shell can locate it in PATH.
Tip: Use brew install tmux and run tmux -V to confirm version. - 2
Launch a new session
Start a named session to keep your workflow organized. This creates an isolated workspace you can detach and reattach freely.
Tip: Choose a meaningful session name like 'dev' or 'project'. - 3
Set the prefix (optional)
If you prefer a different prefix, edit ~/.tmux.conf and reload. This avoids conflicts with other macOS shortcuts.
Tip: Test new prefix in a blank tmux session. - 4
Create windows and panes
Use new-window and split-window commands to lay out your workspace with editor, shell, and logs panes.
Tip: Keep a simple layout for maximum speed. - 5
Navigate panes and windows
Use select-pane and next-window to move focus as you work across panes and windows.
Tip: Practice with real tasks to build muscle memory. - 6
Resize panes
Adjust pane sizes to fit your current task with resize-pane and -L/-D/-U/-R options.
Tip: Aim for balanced visibility, not exact pixels. - 7
Detach and reattach
Detach when needed to preserve state, then reattach with tmux attach -t <session> to resume.
Tip: Detaching early avoids losing progress. - 8
Customize more with ~/.tmux.conf
Persist useful bindings and preferences across sessions by editing your config file.
Tip: Comment configurations to remember intent. - 9
Copy mode basics
Enter copy mode (Ctrl+b [), move with vim or arrow keys if enabled, and copy with Enter or y depending on mode.
Tip: Enable mode-keys vi for faster navigation. - 10
Persist and recover sessions
For long-term work, rely on named sessions and regular reattachments to keep context intact.
Tip: Document your session structure for onboarding.
Prerequisites
Required
- Required
- Required
- Required
- Basic shell knowledge (bash/zsh)Required
Optional
- Optional
Keyboard Shortcuts
| Action | Shortcut |
|---|---|
| Create new windowAfter prefix, create a new window. | Ctrl+b c |
| Split pane verticallySplit current pane into left/right panes. | Ctrl+b % |
| Split pane horizontallySplit current pane into top/bottom panes. | Ctrl+b " |
| Detach from sessionLeave session running in the background. | Ctrl+b d |
| Move focus to left paneNavigate between panes. | Ctrl+b Left |
| Move to next windowCycle through windows. | Ctrl+b n |
Questions & Answers
What is the default prefix in tmux on Mac?
The default prefix is Ctrl+b. After pressing it, the next key executes a command (e.g., c to create a window, % to split, or a directional key to move panes).
The default prefix is Ctrl+b; after you press it, you issue a command with the next key.
Can I change the prefix to Ctrl+a?
Yes. Edit ~/.tmux.conf to change the prefix, then reload the config with tmux source-file ~/.tmux.conf. You may unbind the old prefix and rebind the new one.
Yes, you can change the prefix by editing your tmux config and reloading it.
How do I copy text in tmux on Mac?
Enter copy mode with Ctrl+b [, move with arrow keys or Vi keys if enabled, select text, and copy with Enter (or using copy-pipe in Vi mode).
Use copy mode to select and copy text in tmux.
How do I detach and reattach tmux sessions?
Detach with Ctrl+b d, then reattach using tmux attach -t <session>. Detaching allows background work to continue.
Detach to leave a session running, then reattach later to resume.
What if my prefix is intercepted by the Terminal?
Check Terminal settings or consider remapping the prefix in ~/.tmux.conf and reload. Avoid using conflicting global shortcuts.
If the prefix is blocked, adjust terminal shortcuts or move the prefix to a different key.
Is tmux installed by default on macOS?
tmux is not installed by default on macOS. Install it via Homebrew or another package manager and ensure PATH includes tmux.
tmux isn’t preinstalled on Macs; install it with a package manager and confirm it works.
Main Points
- Master the Ctrl+b prefix
- Split panes with % and " for quick layouts
- Detach/reattach sessions to preserve work
- Customize ~/.tmux.conf to fit your workflow
- Use copy-mode to safely select and copy text
