【问题标题】:git diff with opendiff gives "Couldn't launch FileMerge" error带有 opendiff 的 git diff 给出“无法启动 FileMerge”错误
【发布时间】:2012-05-16 05:09:11
【问题描述】:

我已将 git 配置为使用 ~/bin/opendiff-git.sh 作为我的外部差异工具。该脚本如下所示:

opendiff $2 $5

当我尝试从命令行执行 git diff 时,我收到以下消息:

2011-02-18 13:58:55.532 opendiff[27959:60f] exception raised trying to run FileMerge: launch path not accessible
2011-02-18 13:58:55.535 opendiff[27959:60f] Couldn't launch FileMerge
external diff died, stopping at source/some_file.m.

发生了什么事?这已经工作了好几个月,但最近停止工作。

【问题讨论】:

    标签: xcode git filemerge opendiff


    【解决方案1】:

    所以在我删除了 beta 开发者文件夹以尝试解决这个问题之后(无法使用合并工具进行修复),我在命令行中偶然发现了这个:

    Error: No developer directory found at /Developer Beta. Run /usr/bin/xcode-select to update the developer directory path.
    

    原来你可以设置你需要它使用的开发者路径:

    Usage: xcode-select -print-path
       or: xcode-select -switch <xcode_folder_path>
       or: xcode-select -version
    Arguments:
       -print-path                     Prints the path of the current Xcode folder
       -switch <xcode_folder_path>     Sets the path for the current Xcode folder
       -version  
    

    看起来安装测试版已自动将该路径设置为测试版。要修复它,请运行:

    sudo /usr/bin/xcode-select -switch /Developer
    

    这为我解决了问题。

    更新

    Ying 下面的评论很重要,可以包含在答案中。从 Xcode 4.3 开始,该文件夹的位置已更改为在应用程序包内:

    sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/
    

    【讨论】:

    • 甜蜜,这对我有用。在 Lion 上使用 4.3 时,Developer 文件夹现在位于 Xcode 包本身中,因此:sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/
    【解决方案2】:

    如果您安装了两个 SDK,而最新(可能是测试版)版本没有安装系统工具,则某些工具(如 opendiff)可能会损坏。您一次只能安装一套系统工具,因此您必须选择哪个 SDK/安装有它。我通过使用安装了系统工具的 Developer 文件夹中的 opendiff 路径解决了这个问题。

    就我而言,我有以下 Xcode 安装:

    当前稳定版本(安装了系统工具)

    /Developer
    

    最新测试版(未安装系统工具)

    /Developer (iOS SDK XXX beta)
    

    我的~/bin/opendiff-git.sh 脚本现在看起来像这样:

    "/Developer/usr/bin/opendiff" $2 $5
    

    【讨论】:

    • 即使添加该文件后,我仍然收到错误... :( 我不确定为什么...您确定 ~/bin/... 部分吗?跨度>
    • 我最初在这里使用了这个答案来设置它:stackoverflow.com/questions/736911/…。唯一不同的是,我将opendiff-git.sh 放在~/bin 中而不是~,这意味着您还必须将git diff.external 全局配置选项设置为~/bin/opendiff-git.sh。如果您的 opendiff-git.sh 脚本在您的主目录中,您可以删除 bin
    【解决方案3】:

    首先原因是xcode的安装路径从4.3开始修改,所以必须重新选择xcode路径

    完整指南在以下链接中: http://useyourloaf.com/blog/2012/2/17/updating-to-xcode-43.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-03
      • 1970-01-01
      • 2014-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多