xcode 带有 opendiff 的 git diff 给出“无法启动 FileMerge”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5037230/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:15:26  来源:igfitidea点击:

git diff with opendiff gives "Couldn't launch FileMerge" error

xcodegitfilemergeopendiff

提问by Nick Forge

I have git configured to use ~/bin/opendiff-git.sh as my external diff tool. That script looks like this:

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

opendiff  

When I try and do a git diff from the command line, I get this message:

当我尝试从命令行执行 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.

What's going on? This has worked for many months, but stopped working recently.

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

回答by Bob Spryn

So AFTER I deleted the beta developer folder to try and solve this (couldn't get the fix to work with merge tool) I stumbled upon this in the command line:

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

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

Turns out you can set the developer path you need it to use:

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

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  

Looks like installing the beta had automatically set that path to beta. To fix it, run this:

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

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

That fixed it for me.

那为我修好了。

Update

更新

Ying's comment below was important enough to include in the answer. From Xcode 4.3 on, the location of the folder has changed to inside the application package:

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

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

回答by Nick Forge

If you have two SDKs installed, and the latest (presumably beta) version doesn't have the System Tools installed, some tools like opendiffcan break. You can only have one set of System Tools installed at a time, so you have to choose which SDK/installation has it. I fixed this problem by using the path of opendiffthat is in the Developer folder that had the system tools installed.

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

In my case, I have the following Xcode installations:

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

Current stable release (with System Tools installed)

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

/Developer

Latest beta (without System Tools installed)

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

/Developer (iOS SDK XXX beta)

My ~/bin/opendiff-git.shscript now looks like this:

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

"/Developer/usr/bin/opendiff"  

回答by Foster Yin

first the reason is xcode's installation path modified since 4.3, so must reselect xcode path

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

full guide is in below link: http://useyourloaf.com/blog/2012/2/17/updating-to-xcode-43.html

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