mac os catalina下xcode打开安装组件失败问题

升级到最新系统mac os catalina xcode需要安装组件,但是安装失败,安装记录文件如下:

2019-11-14 11:52:20+08 codeceo Xcode[8043]: Package: PKLeopardPackage <id=com.apple.pkg.MobileDeviceDevelopment, version=13.0.0.9000000001.1.1565773556, url=file:///Applications/Xcode.app/Contents/Resources/Packages/MobileDeviceDevelopment.pkg> Failed to verify with error: Error Domain=PKInstallErrorDomain Code=102 “The package “MobileDeviceDevelopment.pkg” is untrusted.” UserInfo={NSLocalizedDescription=The package “MobileDeviceDevelopment.pkg” is untrusted., NSURL=MobileDeviceDevelopment.pkg — file:///Applications/Xcode.app/Contents/Resources/Packages/, PKInstallPackageIdentifier=com.apple.pkg.MobileDeviceDevelopment, NSUnderlyingError=0x7fd90a8bc240 {Error Domain=NSOSStatusErrorDomain Code=-2147409654 “CSSMERR_TP_CERT_EXPIRED” UserInfo={SecTrustResult=5, PKTrustLevel=PKTrustLevelExpiredCertificate, NSLocalizedFailureReason=CSSMERR_TP_CERT_EXPIRED}}}

解决办法:

在macOS Catalina

cd /Applications/Xcode.app/Contents/Resources/Packages
sudo rm -rf MobileDevice.pkg
sudo rm -rf MobileDeviceDevelopment.pkg 

再试一次。