41

I updated to MacOS Catalina and now my Xcode is not opening. I get this prompt:

enter image description here

Which leads to this error after getting root access:

enter image description here

There is a huge log but the key errors are:

2019-11-04 12:39:48+05 tk_lpt_0141_wifi Xcode[1214]: Package: PKLeopardPackage 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=0x7fe07012cad0 {Error Domain=NSOSStatusErrorDomain Code=-2147409654 "CSSMERR_TP_CERT_EXPIRED" UserInfo={SecTrustResult=5, PKTrustLevel=PKTrustLevelExpiredCertificate, NSLocalizedFailureReason=CSSMERR_TP_CERT_EXPIRED}}} 2019-11-04

13:01:20+05 tk_lpt_0141_wifi Xcode[1306]: Package: PKLeopardPackage 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=0x7fd230cb1ae0 {Error Domain=NSOSStatusErrorDomain Code=-2147409654 "CSSMERR_TP_CERT_EXPIRED" UserInfo={SecTrustResult=5, PKTrustLevel=PKTrustLevelExpiredCertificate, NSLocalizedFailureReason=CSSMERR_TP_CERT_EXPIRED}}} 2019-11-04

13:29:51+05 tk_lpt_0141_wifi Xcode[1377]: Package: PKLeopardPackage 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=0x7f8ab8ba9380 {Error Domain=NSOSStatusErrorDomain Code=-2147409654 "CSSMERR_TP_CERT_EXPIRED" UserInfo={SecTrustResult=5, PKTrustLevel=PKTrustLevelExpiredCertificate, NSLocalizedFailureReason=CSSMERR_TP_CERT_EXPIRED}}}

I have already tried:

xcode-select --install

and

xcode-select --reset

Has anyone else run into this issue? How to fix it?

NSNoob
  • 5,548
  • 6
  • 41
  • 54
  • What version of Xcode? – trojanfoe Nov 04 '19 at 09:05
  • @trojanfoe 11. It was fixed with Vinod's solution below – NSNoob Nov 04 '19 at 09:46
  • 1
    11 isn't the latest version though. Also what version of Catalina as 10.15.0 isn't the latest either. It's important to give version details for these types of questions. Also changing your clock to fix an issue is a massive hack. – trojanfoe Nov 04 '19 at 10:01
  • 1
    The official Apple solution can be found in an answer to an earlier question [here](https://stackoverflow.com/questions/58550284/mobiledevice-pkg-untrusted-cannot-open-xcode-after-os-x-update/58598570#58598570): – David Buck Nov 28 '19 at 11:14

2 Answers2

90

First, try updating Xcode through the app store

As a last resort, you can change your MacOS Date to

1st October 2019

I set my system time to 1st October 2019, the date when the certificate was still valid. Then, I opened Xcode and followed the component install. This went well, and now Xcode works again.

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

Corey Cole
  • 2,262
  • 1
  • 26
  • 43
Vinod Kumar
  • 3,375
  • 1
  • 17
  • 35
  • 13
    That date thing works. Damn, Apple ... ‍♂️ – ehrpaulhardt Nov 05 '19 at 10:35
  • 3
    After changing the system time I couldn't change it back, because I lost my sudo rights. I also couldn't open any https website, because the browser said, that my clock is behind. And I couldn't install the components, because the system didn't accept my password anymore. So be warned! This workaround only works if you have root access on your workplace computer. – asmaier Nov 05 '19 at 14:32
  • Xcode 11.2 was released on 31st October 2019. Why would there be a need to set the clock 1 month prior to the release? – Cœur Nov 06 '19 at 11:20
  • 1
    due to CSSMERR_TP_CERT_EXPIRED resultant com.apple.softwareupdated was invalidated @Cœur – Vinod Kumar Nov 06 '19 at 13:38
  • 2
    Not a recommended solution, it can cause more issues. Updating via the App Store is the only valid answer. – Serge Liberloo Nov 09 '19 at 09:53
  • You can update your system time again for actual. @SergeLiberloo – Vinod Kumar Nov 09 '19 at 10:48
  • macOS (software in general) doesn't like the system clock changing very much. It plays havoc with anything that has a cache and secure systems like keychain. Here's what I did: create an admin user account on your mac, log out of your account, and do the system time trick as that new admin user. Then, once the components are installed, set the clock back, log back in as your main user and delete the temporary admin account. Done! – joerick Nov 12 '19 at 19:10
  • 1
    Love the trick. I'll try to do the same while checking for Apple Care expiration! :D – Alain1405 Nov 21 '19 at 08:37
  • I can't believe it – Apperside Dec 19 '19 at 20:36
  • Baffling this worked. But unsurprised given most of my most recent Apple developer experiences – Nick Sarafa Feb 15 '20 at 05:31
  • this was the solution.. i have sierra 10.13.6. – AlejandroDG Apr 03 '20 at 12:55
  • and they wonder why we developers hate Mac. Thanks – A Khudairy May 20 '20 at 11:45
16

What worked for me was updating Xcode in the App Store. After that I was able to install the additional components successfully.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Lily Pham
  • 161
  • 5
  • 3
    I try to avoid changing my clock since it has caused other problems in the past. I installed Xcode from the App Store, launched, installed components, done. Thanks for the answer! – slothbear Nov 06 '19 at 19:50
  • 1
    Indeed the only valid answer to this issue. It would have been nice is Xcode made this suggestion itself when this error occurs. – Serge Liberloo Nov 09 '19 at 09:55
  • I can't update Xcode from the app store, it downloads the full 7GB or so and then runs through the same 'additional components' install problem. – Richard Hedges Nov 22 '19 at 13:58
  • This should be the accepted answer. It is not a good idea to change your system clock if you don't need to. – Corey Cole Dec 18 '19 at 05:24
  • Many developers have more than one version of XCode installed for a variety of necessary reasons. It's not all about updating to the latest version of XCode. If we could all support all iOS software and devices from the latest version of XCode life would be simple. – davew Jan 13 '20 at 21:46