
Cli Anything Iterm2 Ctl
- 353 installs
- 46.6k repo stars
- Updated August 3, 2026
- hkuds/cli-anything
cli-anything-iterm2-ctl is a macOS CLI skill that lets coding agents send commands to iTerm2 sessions, read live output and scrollback, manage windows and split panes, and snapshot workspace state for developers automati
About
cli-anything-iterm2-ctl is a cli-anything skill from hkuds/cli-anything providing the authoritative CLI for driving iTerm2 on macOS. Commands send text to sessions, read live terminal output and scrollback history, manage windows, tabs, and split panes, run tmux -CC workflows, broadcast to multiple panes, show macOS dialogs, and read or write iTerm2 preferences. The app snapshot command returns every session's name, current directory, foreground process, role label, and last output line in one call. Developers reach for cli-anything-iterm2-ctl when agents must orient in an existing iTerm2 workspace instead of guessing from general terminal knowledge.
- iTerm2 session and pane control
- Profile and window automation
- Agent-safe CLI command surface
- Local dev terminal orchestration
- hkuds/cli-anything wrapper pattern
Cli Anything Iterm2 Ctl by the numbers
- 353 all-time installs (skills.sh)
- +12 installs in the week ending Aug 2, 2026 (Skillselion tracking)
- Ranked #159 of 550 CLI & Terminal skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/hkuds/cli-anything --skill cli-anything-iterm2-ctlAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 353 |
|---|---|
| repo stars | ★ 46.6k |
| Last updated | August 3, 2026 |
| Repository | hkuds/cli-anything ↗ |
How do agents send commands to iTerm2 sessions?
Let coding agents drive iTerm2 sessions, splits, profiles, and commands for reproducible terminal automation during local dev and ops tasks.
Who is it for?
macOS developers using iTerm2 who need agents to read live terminal state and drive splits, tmux -CC, or broadcast workflows reproducibly.
Skip if: Linux or Windows terminal environments, VS Code integrated terminal-only workflows, or teams not using iTerm2 on macOS.
When should I use this skill?
The user wants to orient, send commands, check running processes, or manage splits in an existing iTerm2 workspace.
What you get
Executed terminal commands, captured scrollback output, managed pane layouts, and session snapshot orientation data.
- session snapshot report
- command output capture
Files
cli-anything-iterm2
Stateful CLI harness for iTerm2. Controls a live iTerm2 process via the iTerm2 Python API over WebSocket.
Prerequisites
1. macOS + iTerm2 running: brew install --cask iterm2 2. Python API enabled: iTerm2 → Preferences → General → Magic → Enable Python API 3. Install: pip install cli-anything-iterm2 (or pip install -e . from source)
Basic Syntax
cli-anything-iterm2 [--json] <group> <command> [OPTIONS] [ARGS]Always use --json for machine-readable output (required for agent use).
Command Groups
| Group | Purpose |
|---|---|
app | App status, workspace snapshot, context management, app-level variables, modal dialogs, file panels |
window | Create, list, close, resize, fullscreen windows |
tab | Create, list, close, activate tabs; navigate split panes by direction |
session | Send text, inject raw bytes, read screen, full scrollback, split panes, prompt detection |
profile | List profiles, get profile details, list/apply color presets |
arrangement | Save and restore window layouts |
tmux | Full tmux -CC integration: bootstrap, connections, windows, commands |
broadcast | Sync keystrokes across panes via broadcast domains |
menu | Invoke any iTerm2 menu item programmatically |
pref | Read/write global iTerm2 preferences; list all valid keys; tmux settings |
Orienting in an Existing Workspace
Use app snapshot when you land in a session with existing panes and need to understand what's running without reading full screen contents for each pane:
cli-anything-iterm2 --json app snapshotReturns name, current directory, foreground process, user.role label, and last visible output line for every session across all windows.
Naming convention — label panes when setting up a workspace so you can find them later:
cli-anything-iterm2 session set-var user.role "api-server"
cli-anything-iterm2 session set-var user.role "log-tail"
cli-anything-iterm2 session set-var user.role "editor"app snapshot will surface these roles alongside process and path, giving you a full picture in one call.
Typical Agent Workflow
# 1. Orient — snapshot every session: name, path, process, role, last output line
cli-anything-iterm2 --json app snapshot
# 2. Establish context (saves window/tab/session IDs for subsequent commands)
cli-anything-iterm2 app current
# 3. Interact — no --session-id needed once context is set
cli-anything-iterm2 session send "git status"
cli-anything-iterm2 --json session scrollback --tail 200 --strip
# 4. Create a multi-pane workspace — label panes so snapshot identifies them later
cli-anything-iterm2 session split --vertical --use-as-context
cli-anything-iterm2 session send "python3 -m http.server 8000"
cli-anything-iterm2 session set-var user.role "http-server"Reference Files
Read only what the task requires — each file is a single narrow concern (~10–30 lines):
| File | Read when you need... |
|---|---|
references/session-io.md | Send text, inject bytes, read screen/scrollback, get selection |
references/session-control.md | Split panes, activate/close sessions, resize, rename, session variables |
references/session-shell-integration.md | wait-prompt, wait-command-end, get-prompt; reliable send→wait→read pattern |
references/layout-window-tab.md | Create/close/resize windows and tabs, navigate split panes |
references/layout-arrangement.md | Save and restore window layouts |
references/app-context.md | Snapshot (orientation), status, context management, app vars, modal dialogs, file panels |
references/profile-pref.md | Profiles list/get/presets, preferences read/write, tmux pref shortcuts |
references/broadcast-menu.md | Broadcast keystrokes to multiple panes, invoke menu items |
references/tmux-commands.md | All tmux CLI commands (bootstrap, send, tabs, create-window, set-visible) |
references/tmux-guide.md | Full tmux -CC workflow, pane→session ID mapping |
references/json-session.md | --json schemas for session, window, tab, screen, scrollback, inject |
references/json-tmux-app.md | --json schemas for tmux, app dialogs, preferences, errors |
REPL Mode
Run without arguments for an interactive REPL that maintains context between commands:
cli-anything-iterm2Related skills
FAQ
What does cli-anything-iterm2-ctl app snapshot return?
cli-anything-iterm2-ctl app snapshot is the primary orientation command returning every iTerm2 session's name, current directory, foreground process, role label, and last output line in a single call.
Which terminal does cli-anything-iterm2-ctl support?
cli-anything-iterm2-ctl targets iTerm2 on macOS exclusively. Agents should read this skill instead of general terminal knowledge when driving iTerm2 sessions, splits, or tmux -CC workflows.