Xcode报错“Failed to load plug-in”解决方案

Xcode报错“Failed to load plug-in”解决方案

 次点击
23 分钟阅读

错误描述

升级了Xcode 16 beta3后无法正常启动,报错显示

Failed to load plug-in.

通过命令行启动可以发现错误信息

Last login: Sun Jul 14 22:51:58 on console
/Users/xxx/.zprofile:8: no such file or directory: /opt/homebrew/bin/brew
/Applications/Xcode.app/Contents/MacOS/Xcode ; exit;
(base) xxx@xxx-MacBook-Pro ~ % /Applications/Xcode.app/Contents/MacOS/Xcode ; exit;
2024-07-14 23:36:21.310 Xcode[12515:134266] [MT] DVTPlugInLoading: Failed to load code for plug-in com.apple.dt.XcodeCloud (/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework), error = Error Domain=NSCocoaErrorDomain Code=3588 "dlopen(/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework/XcodeCloud, 0x0109): Library not loaded: /Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads
  Referenced from: <52C800B6-442E-3347-B218-E153799E5D39> /Applications/Xcode.app/Contents/PlugIns/IDESourceEditor.framework/Versions/A/IDESourceEditor
  Reason: tried: '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file)" UserInfo={NSLocalizedFailureReason=The bundle couldn’t be loaded., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework/XcodeCloud, NSDebugDescription=dlopen(/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework/XcodeCloud, 0x0109): Library not loaded: /Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads
  Referenced from: <52C800B6-442E-3347-B218-E153799E5D39> /Applications/Xcode.app/Contents/PlugIns/IDESourceEditor.framework/Versions/A/IDESourceEditor
  Reason: tried: '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), NSBundlePath=/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework, NSLocalizedDescription=The bundle “XcodeCloud” couldn’t be loaded.}, dyldError = dlopen(/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework/XcodeCloud, 0x0000): Library not loaded: /Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads
  Referenced from: <52C800B6-442E-3347-B218-E153799E5D39> /Applications/Xcode.app/Contents/PlugIns/IDESourceEditor.framework/Versions/A/IDESourceEditor
  Reason: tried: '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file)
2024-07-14 23:36:21.311 Xcode[12515:134266] [MT] DVTAssertions: Warning in IDEFrameworks/IDEFoundation/Initialization/IDEInitialization.m:329
Details:  Xcode failed its initial plug-in scan, error = Error Domain=DVTPlugInErrorDomain Code=2 "Loading a plug-in failed." UserInfo={DVTPlugInIdentifierErrorKey=com.apple.dt.XcodeCloud, DVTPlugInExecutablePathErrorKey=/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework/XcodeCloud, NSLocalizedRecoverySuggestion=The plug-in or one of its prerequisite plug-ins may be missing or damaged and may need to be reinstalled., DVTPlugInDYLDErrorMessageErrorKey=dlopen(/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework/XcodeCloud, 0x0000): Library not loaded: /Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads
  Referenced from: <52C800B6-442E-3347-B218-E153799E5D39> /Applications/Xcode.app/Contents/PlugIns/IDESourceEditor.framework/Versions/A/IDESourceEditor
  Reason: tried: '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), NSLocalizedDescription=Loading a plug-in failed., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework, NSLocalizedFailureReason=The plug-in “com.apple.dt.XcodeCloud” at path “/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework” could not be loaded.  The plug-in or one of its prerequisite plug-ins may be missing or damaged., NSUnderlyingError=0x600003d3af10 {Error Domain=NSCocoaErrorDomain Code=3588 "dlopen(/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework/XcodeCloud, 0x0109): Library not loaded: /Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads
  Referenced from: <52C800B6-442E-3347-B218-E153799E5D39> /Applications/Xcode.app/Contents/PlugIns/IDESourceEditor.framework/Versions/A/IDESourceEditor
  Reason: tried: '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file)" UserInfo={NSLocalizedFailureReason=The bundle couldn’t be loaded., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework/XcodeCloud, NSDebugDescription=dlopen(/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework/XcodeCloud, 0x0109): Library not loaded: /Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads
  Referenced from: <52C800B6-442E-3347-B218-E153799E5D39> /Applications/Xcode.app/Contents/PlugIns/IDESourceEditor.framework/Versions/A/IDESourceEditor
  Reason: tried: '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), '/Library/Developer/PrivateFrameworks/DVTDownloads.framework/Versions/A/DVTDownloads' (no such file), NSBundlePath=/Applications/Xcode.app/Contents/PlugIns/XcodeCloud.framework, NSLocalizedDescription=The bundle “XcodeCloud” couldn’t be loaded.}}}
Function: BOOL _IDEInitializePlugInManager(IDEInitializationOptions, NSError *__autoreleasing  _Nullable * _Nullable)
Thread:   <_NSMainThread: 0x600003a8c0c0>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...       9 completed.

[Process completed]

解决方案

安装/Applications/Xcode.app/Contents/Resources/Packages目录下的所有pkg即可正常启动。

https://forums.developer.apple.com/forums/thread/660860

参考来源

补充的解决方案

在尝试上面的方案前还参考了其他的手段,或许也需要进行操作

  • 升级brew

brew update
brew upgrade
  • Xcode 首次启动

xcodebuild -runFirstLaunch
  • 重新安装 Command Line Tools

© 本文著作权归作者所有,未经许可不得转载使用。