Configs2026年5月13日·1 分钟阅读

iTerm2 — Feature-Rich Terminal Emulator for macOS

A GPL-licensed replacement for the macOS Terminal app that adds split panes, search, autocomplete, and extensive customization to your command-line workflow.

Introduction

iTerm2 is a terminal emulator for macOS that serves as a drop-in replacement for the built-in Terminal app. It provides a large set of power-user features that make daily command-line work faster and more ergonomic, while remaining free and open-source under the GPL v2 license.

What iTerm2 Does

  • Provides tabbed and split-pane terminal sessions with independent scroll histories
  • Offers inline image display directly in the terminal via its proprietary image protocol
  • Supports triggers and automatic profile switching based on hostname, username, or path
  • Integrates with the macOS system through native notifications, Applescript, and Services
  • Includes a built-in password manager and tmux integration mode for session persistence

Architecture Overview

iTerm2 is built in Objective-C and Swift on top of macOS Cocoa frameworks. It uses a custom terminal emulator core that handles VT100/xterm escape sequences, with a Metal-accelerated rendering pipeline for smooth scrolling and high frame rates on Retina displays. The shell integration feature communicates with the running shell via invisible escape sequences to track working directories, command status, and history.

Self-Hosting & Configuration

  • Install via Homebrew Cask, direct download from the official site, or build from source
  • Import and export profiles as JSON for sharing configurations across machines
  • Install shell integration scripts for bash, zsh, or fish to enable directory tracking and command status
  • Customize key mappings, color schemes, and fonts through the Preferences panel
  • Use dynamic profiles stored as JSON files in a watched directory for automated provisioning

Key Features

  • GPU-accelerated rendering with Metal for minimal latency and high throughput
  • Instant Replay lets you rewind terminal output to review past content
  • Smart selection recognizes URLs, file paths, and email addresses for quick actions
  • Python scripting API enables automation and custom extensions within the terminal
  • Supports ligatures, Unicode, and emoji rendering for modern coding fonts

Comparison with Similar Tools

  • Alacritty — GPU-accelerated and cross-platform but offers fewer built-in features and no split panes natively
  • kitty — cross-platform with image protocol support, but uses a different configuration paradigm
  • WezTerm — Lua-configurable multiplexer that runs on Linux, macOS, and Windows
  • Ghostty — newer cross-platform terminal focused on correctness and performance, still maturing in features
  • macOS Terminal — built-in and lightweight, but lacks split panes, triggers, and advanced scripting

FAQ

Q: Is iTerm2 free? A: Yes. iTerm2 is free and open-source under the GPL v2 license. There is no paid tier.

Q: Does iTerm2 work with tmux? A: Yes. iTerm2 has a unique tmux integration mode that maps tmux windows and panes to native iTerm2 tabs and splits.

Q: Can I display images in the terminal? A: iTerm2 supports inline image display using its imgcat utility and the iTerm2 image protocol, which is also adopted by other terminals.

Q: Does it support shell integration? A: Yes. Shell integration scripts for bash, zsh, and fish add features like command status marks, recent directory tracking, and download-with-scp.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产