与opendiff的git diff给出"无法启动FileMerge"错误

Nic*_*rge 13 git xcode filemerge opendiff

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

opendiff $2 $5
Run Code Online (Sandbox Code Playgroud)

当我尝试从命令行执行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.
Run Code Online (Sandbox Code Playgroud)

这是怎么回事?这已经工作了好几个月,但最近停止了工作.

Bob*_*ryn 31

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

Error: No developer directory found at /Developer Beta. Run /usr/bin/xcode-select to update the developer directory path.
Run Code Online (Sandbox Code Playgroud)

事实证明,您可以设置您需要使用的开发人员路径:

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  
Run Code Online (Sandbox Code Playgroud)

看起来安装测试版已经自动设置了测试路径.要修复它,请运行以下命令:

sudo /usr/bin/xcode-select -switch /Developer
Run Code Online (Sandbox Code Playgroud)

这为我解决了这个问题.

更新

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

sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/
Run Code Online (Sandbox Code Playgroud)

  • 甜,这对我有用.4.3在Lion上,开发者文件夹现在是在Xcode捆绑本身,因此:须藤的/ usr/bin中/ Xcode中,选择-switch /Applications/Xcode.app/Contents/Developer/ (20认同)