You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

macOS更新后Sourcetree无法启动外部冲突解决工具怎么办?

解决macOS更新后Sourcetree无法启动外部冲突工具的问题

1. 检查冲突工具的系统权限

  • 打开「系统设置」→「隐私与安全性」,找到「已下载的应用程序」,确认kdiff3或p4merge是否被允许运行(macOS更新后常阻止未公证的第三方应用)。
  • 如果看到对应工具的提示,点击「允许」,之后单独打开工具测试能否正常启动。

2. 重新配置Sourcetree的外部工具路径

  • 打开Sourcetree,点击顶部菜单栏「Sourcetree」→「设置」→「差异」。
  • 在「合并工具」下拉菜单选你要用的工具(kdiff3/p4merge),点击「浏览」手动定位工具的实际执行文件:
    • kdiff3默认路径:/Applications/kdiff3.app/Contents/MacOS/kdiff3
    • p4merge默认路径:/Applications/p4merge.app/Contents/MacOS/p4merge
  • 点击「测试」,确认工具能被Sourcetree正常调用。

3. 修复Git全局冲突工具配置

macOS更新可能会重置Git的全局配置,在终端执行对应工具的配置命令(二选一):

  • 配置kdiff3:
    git config --global merge.tool kdiff3
    git config --global mergetool.kdiff3.path "/Applications/kdiff3.app/Contents/MacOS/kdiff3"
    git config --global mergetool.kdiff3.trustExitCode false
    
  • 配置p4merge:
    git config --global merge.tool p4merge
    git config --global mergetool.p4merge.path "/Applications/p4merge.app/Contents/MacOS/p4merge"
    git config --global mergetool.p4merge.trustExitCode false
    

执行完后,在终端输入git mergetool --tool-help,确认工具已被Git识别。

4. 验证工具本身的可用性

  • 直接在终端运行工具的命令,比如/Applications/kdiff3.app/Contents/MacOS/kdiff3或/Applications/p4merge.app/Contents/MacOS/p4merge,看是否能正常启动。
  • 如果工具无法启动,重新下载适配当前macOS版本的最新版工具,重新安装后再测试。

5. 重置Sourcetree偏好设置(最后手段)

如果以上步骤都无效,重置Sourcetree的偏好:

  • 关闭Sourcetree。
  • 在终端执行:
    rm -rf ~/Library/Application\ Support/com.torusknot.SourceTreeNotMAS.plist
    rm -rf ~/Library/Preferences/com.torusknot.SourceTreeNotMAS.plist
    
  • 重新打开Sourcetree,重新配置外部工具。

内容的提问来源于stack exchange,提问作者Bastian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.11 13:03:19