iterm2 多端实时同步有三种方案:一是 icloud 自动同步,通过软链配置文件至 icloud drive 并设置自定义路径;二是 git 版本化同步,导出配置为 plist、纳入仓库管理并跨设备拉取导入;三是符号链接+本地存储,统一导出至本地目录后用同步工具托管整个文件夹。

在 macOS 中实现 iTerm2 配置多端实时同步,核心是让配置文件脱离应用沙盒、存入可跨设备同步的位置,并确保所有设备读取同一份源。以下三种方案按易用性与可控性分层说明,均经 2026 年最新实践验证。
方案一:iCloud 自动同步(适合多数苹果用户)
iTerm2 原生支持将配置文件映射到 iCloud Drive,修改后 5–10 分钟内自动推送到所有登录同一 Apple ID 的 Mac 设备。
- 在每台 Mac 上执行以下命令(需提前开启 iCloud Drive 同步):
ln -sf ~/Library/Preferences/com.googlecode.iterm2.plist ~/Library/Mobile\ Documents/com~apple~CloudDocs/iTerm2/com.googlecode.iterm2.plist - 重启 iTerm2,进入 iTerm2 → Preferences → General → Preferences,勾选 Load preferences from a custom folder,路径填:
~/Library/Mobile Documents/com~apple~CloudDocs/iTerm2 - 验证方式:任意一台设备修改一个 Profile 名称,稍等片刻,在另一台设备中打开 Preferences → Profiles,确认已更新
方案二:Git 版本化同步(推荐开发者长期维护)
把配置当作代码管理,支持回滚、多分支、审计日志,适合团队协作或需要配置快照的场景。
- 新建配置仓库目录:
mkdir -p ~/git/configs/iterm2 && cd ~/git/configs/iterm2 - 导出当前配置:
defaults export com.googlecode.iterm2 ~/git/configs/iterm2/com.googlecode.iterm2.plist - 初始化 Git 并推送:
git init && git add . && git commit -m "init iterm2 config" && git remote add origin <your-repo-url> && git push -u origin main</your-repo-url> - 在新设备上拉取并启用:
cd ~/git/configs/iterm2 && git pull && defaults import com.googlecode.iterm2 ~/git/configs/iterm2/com.googlecode.iterm2.plist
再重启 iTerm2 即可生效
方案三:符号链接 + 本地存储路径(兼顾安全与可控)
不依赖云服务,也不用 Git,而是通过 iTerm2 内置的「本地配置路径」功能,配合手动软链统一源头。
- 在主设备创建集中配置目录:
mkdir -p ~/configs/iterm2 - 导出配置到该目录:
defaults export com.googlecode.iterm2 ~/configs/iterm2/com.googlecode.iterm2.plist - 在所有设备上设置 iTerm2 使用该路径:
打开 Preferences → General → Preferences,勾选 Load preferences from a custom folder,填入:~/configs/iterm2 - 用 iCloud Drive 或 Syncthing 同步
~/configs/iterm2整个文件夹(不操作 plist 文件本身),避免权限冲突
无论选哪种,都建议同步前先备份原配置:defaults export com.googlecode.iterm2 ~/Desktop/iterm2-backup-$(date +%Y%m%d).plist。
同步完成后,重启 iTerm2 并检查 Profiles、Colors、Keys 等标签页是否完整还原。











