macOS 终端利器 iTerm2 配置指南

iTerm2 是 macOS 上最强大的终端工具之一,本文将介绍如何安装和配置 iTerm2,让它成为你的得力助手。 安装步骤 1. 安装 iTerm2 有两种安装方式: 直接下载:从 iTerm2 官网 下载,解压后拖到 Applications 目录 使用 Homebrew: brew install --cask iterm2 2. 配置主题 下载 Solarized Dark theme:http://ethanschoonover.com/solarized 打开 iTerm2 偏好设置:Command + , 进入 Profiles -> Colors -> Color Presets -> Import 导入下载的 Solarized Dark.itermcolors 文件 选择 Solarized Dark 主题 3. 安装 Oh My Zsh 一键安装: sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 设置 Zsh 为默认 Shell: chsh -s /bin/zsh 配置主题: vim ~/.zshrc # 修改 ZSH_THEME="agnoster" 4. 配置字体 下载并安装 Meslo 字体:Meslo LG M Regular for Powerline.ttf iTerm2 配置: 打开偏好设置:Command + , Profiles -> Text -> Font -> Change Font 选择 “Meslo LG M Regular for Powerline” 字体 5. 增强功能配置 5.1 语法高亮 # 安装 brew install zsh-syntax-highlighting # 配置 echo "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc 5.2 自动补全 # 安装 git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions # 配置 vim ~/.zshrc # 在 plugins 中添加 zsh-autosuggestions plugins=(git zsh-autosuggestions zsh-syntax-highlighting) 5.3 快捷键配置 左右键跳转: 打开偏好设置:Command + , Profiles → Keys → Load Preset… → Natural Text Editing ...

2025-05-26 · 2 分钟 · 257 字 · heyaohua