突然之间,我的 Macbook Air(OS 12.5.1 Monterey)刚开始git
在我输入git status
终端(iTerm2)时要求我安装......
如果我说“不,我不想安装 git”,则会出现以下错误消息:
$ git status
2022-09-21 18:44:57.936 xcodebuild[827:8036] [MT] DVTPlugInLoading: Failed to load code for plug-in com.apple.dt.IDESimulatorAvailability (/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin), error = Error Domain=NSCocoaErrorDomain Code=3588 "dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0109): Symbol not found: (_OBJC_CLASS_$_SimDiskImage)
Referenced from: '/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability'
Expected in: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator'" UserInfo={NSLocalizedFailureReason=The bundle couldn’t be loaded., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, NSDebugDescription=dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0109): Symbol not found: (_OBJC_CLASS_$_SimDiskImage)
Referenced from: '/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability'
Expected in: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator', NSBundlePath=/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin, NSLocalizedDescription=The bundle “IDESimulatorAvailability” couldn’t be loaded.}, dyldError = dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0000): Symbol not found: (_OBJC_CLASS_$_SimDiskImage)
Referenced from: '/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability'
Expected in: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator'
2022-09-21 18:44:58.157 xcodebuild[827:8036] [MT] DVTAssertions: ASSERTION FAILURE in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot2/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-21303/DVTFoundation/PlugInArchitecture/DataModel/DVTPlugIn.m:374
Details: Failed to load code for plug-in com.apple.dt.IDESimulatorAvailability (/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin)
Please ensure Xcode packages are up-to-date — try running 'xcodebuild -runFirstLaunch'.
NSBundle error: Error Domain=NSCocoaErrorDomain Code=3588 "dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0109): Symbol not found: (_OBJC_CLASS_$_SimDiskImage)
Referenced from: '/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability'
Expected in: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator'" UserInfo={NSLocalizedFailureReason=The bundle couldn’t be loaded., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, NSDebugDescription=dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0109): Symbol not found: (_OBJC_CLASS_$_SimDiskImage)
Referenced from: '/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability'
Expected in: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator', NSBundlePath=/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin, NSLocalizedDescription=The bundle “IDESimulatorAvailability” couldn’t be loaded.}
Object: <DVTPlugIn: 0x600000c70460>
Method: -loadAssertingOnError:error:
Thread: <_NSMainThread: 0x600002824140>{number = 1, name = main}
Hints:
Backtrace:
0 0x000000010c315f81
1 0x000000010c3154b5
2 0x000000010c3156c1
3 0x000000010c18c3ba
4 0x000000010c147c73
5 0x000000010c145a1f
6 0x00007ff81e2a0317
7 0x00007ff81e2ad7ee
8 0x000000010c3645a1
9 0x000000010c33a0d8
10 0x000000010c1458a3
11 0x000000010c145af5
12 0x000000010d22af66
13 0x000000010d22a526
14 0x000000010d229919
15 0x000000010abb29a4
16 0x000000010a93520a
sh: line 1: 848 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find git 2> /dev/null
git: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find git 2> /dev/null' failed with exit code 34304: (null) (errno=Invalid argument)
xcode-select: Failed to locate 'git', requesting installation of command line developer tools.
PS,我刚刚说“是”安装git,大约花了30分钟,现在它要求重新安装它!我只是重新启动计算机以防万一,但如果我说不,它仍然会抛出相同的消息和错误。
下面是两张截图:
为什么这突然随机开始发生,以及如何解决它的任何想法?我已经有一段时间没有下载任何东西了,而且我很确定操作系统今天没有自动更新。也许 iTerm2 更新了或其他什么...不,我尝试git status
在实用程序 > 终端应用程序中运行,同样的处理...
澄清一下,我已经在我的 Macbook Air 上git status
工作了多年,而且我最近没有改变任何东西。所以奇怪的事情正在发生。我的硬盘上还有 85GB 的空间,所以我不认为这不是空间问题......
当Xcode
git
以./usr/bin/git
_xcodebuild
_ 如果你的 Xcode 安装有问题,这个技巧就会失效。git
/Applications/Xcode.app
如果您从 App Store 安装 Xcode,它可能刚刚自动更新到 Xcode 14,该版本于上周与 iOS 16 一起发布。Xcode 14 可能有一个新的许可协议,需要在任何与 Xcode 相关的内容之前得到确认跑。或者它可能有一些其他的变化——可能是它如何调用与 Xcode 相关的命令行工具——这将由 Xcode 的首次运行初始化过程修复。
如果您不使用或不关心 Xcode 并且想要一个
git
不绑定到 Xcode 的版本,请git
通过 Homebrew 或其他方式安装您自己的副本,并使用它而不是 Xcode-installed/usr/bin/git
。顺便说一句,这与 iTerm2 无关。macOS 的内置终端应用程序也会遇到同样的问题。您发布的错误消息都来自 Xcode 的一部分(以及其中一个 Xcode 片段所做的一次 Bourne shell 调用)。