MobileDevice.pkg 不受信任,OS X 更新后无法打开 Xcode

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/58550284/
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-08 18:37:12  来源:igfitidea点击:

MobileDevice.pkg untrusted, cannot open Xcode after OS X update

xcodemacosmacos-catalina

提问by eja08

After an automatic update of macOS v10.15(Catalina), I am unable to open Xcode. Xcode prompts me to install additional components but the installation fails because of MobileDevice.pkg (Applications/Xcode.app/Contents/Resources/Packages)

macOS v10.15(Catalina)自动更新后,我无法打开 Xcode。Xcode 提示我安装其他组件但安装失败,因为 MobileDevice.pkg (Applications/Xcode.app/Contents/Resources/Packages)

I have found multiple answers on how to locate MobileDevice.pkg and that I should try to install it directly, but when I try to do this the installation fails too. I have also tried updating Xcode from App Store, but the update failed when it was nearly finished.

我找到了关于如何找到 MobileDevice.pkg 的多个答案,我应该尝试直接安装它,但是当我尝试这样做时,安装也失败了。我也尝试过从App Store更新 Xcode ,但是当它快完成时更新失败了。

Has anyone experienced the same behaviour? Should I reset the Mac to default and install macOS v10.13(High Sierra) or Catalina from scratch or it is a problem of Xcode and re-install would do the job?

有没有人经历过同样的行为?我应该将 Mac 重置为默认值并从头开始安装macOS v10.13(High Sierra) 或 Catalina 还是 Xcode 的问题并重新安装可以完成这项工作?

I have found a discussion herethat was posted today and is probably regarding the same issue and it seems like many people are dealing with it, too.

我在这里找到了今天发布的讨论,可能是关于同样的问题,而且似乎很多人也在处理它。

The log:

日志:

*2019-10-25 01:03:34+02 Vendula-MacBook-Pro Xcode[1567]: Package: PKLeopardPackage 
<id=com.apple.pkg.MobileDevice, version=4.0.0.0.1.1567124787, url=file:///Applications/Xcode.app/Contents/Resources/Packages/MobileDevice.pkg> 
Failed to verify with error: Error Domain=PKInstallErrorDomain Code=102 
"The package “MobileDevice.pkg” is untrusted." 
UserInfo={
  NSLocalizedDescription=The package “MobileDevice.pkg” is untrusted., 
  NSURL=MobileDevice.pkg -- file:///Applications/Xcode.app/Contents/Resources/Packages/, 
  PKInstallPackageIdentifier=com.apple.pkg.MobileDevice, 
  NSUnderlyingError=0x7fabf6626d00 
  {
    Error Domain=NSOSStatusErrorDomain 
    Code=-2147409654 "CSSMERR_TP_CERT_EXPIRED" 
    UserInfo={
      SecTrustResult=5, 
      PKTrustLevel=PKTrustLevelExpiredCertificate,   
      NSLocalizedFailureReason=CSSMERR_TP_CERT_EXPIRED
    }
  }
}*

采纳答案by eja08

I didn't have Xcode 11.1 installed and even though I could open and run the 11.0 after the below workaround I could not update to 11.1 as the update always failed. So I have just re-installed the whole app from the App-Store - you could probably also do this instead of the below method.

我没有安装 Xcode 11.1,即使我可以在以下解决方法后打开并运行 11.0,我也无法更新到 11.1,因为更新总是失败。所以我刚刚从 App-Store 重新安装了整个应用程序 - 你也可以这样做而不是下面的方法。

I have tried setting my system time to 1st October 2019 when the certificate should had been still valid. After that I tried to open Xcode and followed the component install which went well and now I am able to work with Xcode again.

我尝试将系统时间设置为 2019 年 10 月 1 日,那时证书应该仍然有效。之后,我尝试打开 Xcode 并按照组件安装进行,这很顺利,现在我可以再次使用 Xcode。

回答by Raphael G. Frantz

Edit and set the date of your Mac as October 1st, 2019.

编辑 Mac 的日期并将其设置为 2019 年 10 月 1 日。

回答by valbu17

I had a similar problem, where I installed Xcode 11.1, and installed the components and everything within the same folder where I had Xcode 10.2.1. Then, I tried to go back to Xcode 10.2.1 and couldn't opened as it was asking me to install components again, and when I tried I was getting this error.

我有一个类似的问题,我安装了 Xcode 11.1,并将组件和所有内容安装在我有 Xcode 10.2.1 的同一文件夹中。然后,我尝试返回 Xcode 10.2.1 并且无法打开,因为它要求我再次安装组件,当我尝试时出现此错误。

The package “MobileDeviceDevelopment.pkg” is untrusted.

包“MobileDeviceDevelopment.pkg”不受信任。

So, the workaround that fixed it for me was navigating to...

所以,为我修复它的解决方法是导航到......

/Users/YourUser/Applications/Xcode\ 10.2.1.app/Contents/Resources/

Then, deleting MobileDeviceDevelopment.pkgand everything went back to normal :)

然后,删除MobileDeviceDevelopment.pkg一切恢复正常:)

I hope this helps anyone else with this issue. Cheers!

我希望这可以帮助其他人解决这个问题。干杯!

回答by JBarros35

At macOS Catalina

在 macOS Catalina

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

Try again. It means you entered on the Xcode downloaded packages and remove it. I really don't understand how Apple do but if you remove Xcode will download it again and revalidates.

再试一次。这意味着您输入了 Xcode 下载的软件包并将其删除。我真的不明白 Apple 是怎么做的,但是如果您删除 Xcode,它将再次下载并重新验证。

Some remarks, I'm on XCODE Version 11.0 (11A420a) if you are not this is not guaranteed to work.

一些评论,我在 XCODE 版本 11.0 (11A420a) 上,如果你不是,这不能保证工作。

回答by Mojtaba Hosseini

You may solve this issue by setting the date of your Mac as October 1st, 2019. But this is just a hack! The real solution (suggested by apple) is this:

您可以通过将 Mac 的日期设置为 2019 年 10 月 1 日来解决此问题。但这只是一个技巧!真正的解决方案(由苹果建议)是这样的:

All you have to is to upgrade Xcode

你所要做的就是升级Xcode

Butthere is a known Issues on apple developers site

但是苹果开发者网站上有一个已知问题

Xcode may fail to update from the Mac App Store after updating to macOS Catalina. (56061273)

更新到 macOS Catalina 后,Xcode 可能无法从 Mac App Store 更新。(56061273)

Apple suggests this:

苹果建议这样做:

To trigger a new download you can delete the existing Xcode.app or temporarily change the file extension so it is no longer visible to the App Store.

要触发新的下载,您可以删除现有的 Xcode.app 或临时更改文件扩展名,使其不再在 App Store 中可见。

Or:

或者:

Always working solution:

始终有效的解决方案:

  1. Go hereand log in.

  2. Then download the xib from here.

  1. 这里并登录。

  2. 然后从这里下载xib

More information here on this answer.

有关此答案的更多信息,请点击此处

回答by user12593755

rm -rf /Applications/Xcode.app/Contents/Resources/Packages/*.pkg

It will work and re-open the x-code

它将工作并重新打开 x-code

回答by Alex

Try to run Xcode-betainstead of Xcodeto install additional components. After that you'll be able to use Xcoderelease.

尝试运行Xcode-beta而不是Xcode安装其他组件。之后,您将能够使用Xcode发布。

回答by zkon

For me, I just uninstalled (deleted the app from the Applications folder) and then went back to app store and clicked the cloud icon and it downloaded fresh and installed. Now all is good and back to normal.

对我来说,我只是卸载了(从应用程序文件夹中删除了该应用程序),然后返回应用程序商店并单击云图标,然后下载并安装了全新的应用程序。现在一切都很好,恢复正常。

回答by exceptionPointerNull

Reinstall Xcode 11.1 from https://developer.apple.com/download/more/. Afterwards the update works.

https://developer.apple.com/download/more/重新安装 Xcode 11.1 。之后更新工作。

回答by dmarnel

This requires Xcode 11.1 to be installed.

这需要安装 Xcode 11.1。

I was not able to update to Xcode 11.1 until I updated macOS Catalina to 10.15.1. After updating my macOS, I was able to install Xcode 11.1, which also allowed the installation of the additional components package.

在将 macOS Catalina 更新到 10.15.1 之前,我无法更新到 Xcode 11.1。更新我的 macOS 后,我能够安装 Xcode 11.1,这也允许安装附加组件包。