Ep 6: iTerm2 — The King of macOS Terminals

⏱ Est. reading time: 9 min Updated on 5/7/2026

The de facto standard for macOS terminals. Features exclusive tmux -CC support and the most extensive scripting capabilities via AppleScript and Python APIs.

Historical Status

Launched in 2008, iTerm2 is the most popular terminal emulator on macOS. Its 15 years of continuous development have resulted in the deepest programmable interfaces available.

Installation

macOS (Only supported platform):

# Option 1: Homebrew (Recommended)
brew install --cask iterm2

# Option 2: Download from official site
# https://iterm2.com/downloads.html

# Option 3: Manual download of .zip
# https://iterm2.com/downloads/stable/latest

Operating System Support

System Support Notes
macOS 10.14+ Full Native Cocoa application
Linux Not Supported macOS exclusive
Windows Not Supported macOS exclusive

Killer Features

1. tmux -CC Mode (Exclusive)

The unique tmux integration only found in iTerm2. No other terminal does this.

# Standard tmux: Everything contained in one window; switch with Ctrl+b
tmux

# tmux -CC Mode: tmux windows become native iTerm2 tabs
tmux -CC

Visual comparison:

Standard tmux:
┌─────────────────────────┐
│ [0:bash] [1:agent] [2:test] │  ← tmux status bar
│ ┌───────────────────────┐ │
│ │ Current pane content   │ │  ← Switch with Ctrl+b
│ └───────────────────────┘ │
└─────────────────────────┘

tmux -CC Mode (iTerm2):
┌─────────────────────────┐
│ bash │ agent │ test      │  ← Native iTerm2 tab bar
│ ┌───────────────────────┐ │
│ │ Current tab content    │ │  ← Switch with Cmd+Number
│ └───────────────────────┘ │
└─────────────────────────┘

Every tmux window becomes a native iTerm2 tab, and every pane becomes a native split. The experience feels completely native.

2. AppleScript Automation

Control iTerm2 entirely through AppleScript:

-- Create a new tab and run Claude Code
tell application "iTerm2"
    tell current window
        set newTab to (create tab with default profile)
        tell current session of newTab
            write text "claude"
        end tell
    end tell
end tell

3. Python API

iTerm2 provides a comprehensive Python API (requires iTerm2 Python Runtime):

import iterm2

async def main(connection):
    app = await iterm2.async_get_app(connection)

    # Create new tab
    window = app.current_window
    tab = await window.async_create_tab()

    # Run command in new tab
    session = tab.current_session
    await session.async_send_text("claude\n")

    # Monitor output changes
    @iterm2.RPC
    async def on_output(session_id, text):
        if "ERROR" in text:
            # Auto-notification
            print(f"Agent Error: {text}")

iterm2.run_forever(main)

4. Hotkey Window

Call up a floating terminal window with a global shortcut. One click to check status, one click to hide.

5. Shell Integration

  • Marks: Mark command locations for quick jumping.
  • Command History Playback: Review all past commands and their outputs.
  • Directory Jumping: Cmd+Shift+H to view recently visited directories.

6. Infinite Scrollback Buffer

Scroll back as far as you need, no matter how much an Agent outputs. iTerm2 supports infinite scrollback (configurable, default 1M lines).

Agent Interaction Mechanism

iTerm2 possesses the richest set of programmable interfaces of any terminal:

flowchart TB
    subgraph Automation Interfaces
        A[AppleScript
Full Terminal Control] B[Python API
Profiles/Triggers/Commands] C[Shell Integration
Command Marks/History] D[tmux -CC
Native Tab Experience] end subgraph Agent Management E[Agent 1
Tab 1] F[Agent 2
Tab 2] G[Agent N
Tab N] end A -->|Create Tabs/Splits| E A -->|Create Tabs/Splits| F B -->|Automation Scripts| E B -->|Automation Scripts| G C -->|Command Tracking| E D -->|Native tmux Exp| H[Remote Agent] style A fill:#2ecc71,color:#fff style B fill:#4a9eff,color:#fff style D fill:#9b59b6,color:#fff

iTerm2 + tmux -CC Multi-Agent Architecture

sequenceDiagram
    participant User as Developer
    participant IT as iTerm2
    participant Tmux as tmux -CC
    participant S1 as Session: agent-1
    participant S2 as Session: agent-2

    User->>IT: tmux -CC
    IT->>Tmux: Start tmux -CC mode
    Tmux->>IT: Register as native tabs

    User->>Tmux: tmux new -t agent-1
    Tmux->>IT: Add native tab "agent-1"
    IT->>S1: Start Claude Code

    User->>Tmux: tmux new -t agent-2
    Tmux->>IT: Add native tab "agent-2"
    IT->>S2: Start Claude Code

    Note over IT: Cmd+1 switch to agent-1
Cmd+2 switch to agent-2
Native experience User->>IT: Close MacBook Note over Tmux: tmux session keeps running User->>IT: Open MacBook → tmux -CC IT->>Tmux: Reconnect Tmux->>IT: Restore all native tabs

Pros & Cons

Pros Cons
Exclusive tmux -CC (Top selling point) macOS only
Deepest AppleScript + Python APIs CPU rendering (~3x slower than Ghostty)
15 years of accumulated features Lags with massive output
Infinite scrollback buffer High resource usage
Mature Shell Integration No built-in AI features
GPL licensed (Open Source) No Agent notification mechanism
Massive community No vertical tab bar

Best Use Cases

  • Heavy macOS + tmux users
  • Scenarios requiring deep automation (AppleScript/Python)
  • Native experience for remote Agents via tmux -CC
  • Developers prioritizing ecosystem depth over extreme speed