252

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)

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.

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?

I have found a discussion here that 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
    }
  }
}*
cat
  • 3,888
  • 5
  • 32
  • 61
eja08
  • 4,600
  • 3
  • 13
  • 19
  • Related: https://apple.stackexchange.com/questions/373461/software-update-on-obsolete-system-is-it-real – MCCCS Oct 25 '19 at 18:04
  • Why is everyone upvoting this over the [Mojtaba Hosseini's answer quoting Apple's official response to this](https://stackoverflow.com/a/58598570/9078867)? Go update Xcode as stated. – Will Nov 08 '19 at 01:51
  • 2
    If you look around, you'll notice everyone is trying to use XCode 10 after installing 11, because we're not ready for Dark Mode. Maybe an indie can handle it, but apps that take years to design just had an entire UI change thrust on them. Nobody's upvoting his answer because it's not relevant to the solution that meets the requirements of the businesses, but it is valid. – Stephen J Nov 14 '19 at 18:39

11 Answers11

378

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

S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
Raphael G. Frantz
  • 3,909
  • 1
  • 8
  • 5
  • 42
    Use October 1st 2019 then after components has been installed, change the date to current again. – Raphael G. Frantz Oct 25 '19 at 21:07
  • 8
    This worked! This solution (though a system hack) is far easier than removing and reinstalling the bulky app again. – Subhash Oct 28 '19 at 14:31
  • 13
    Wow this is amazing and extremely bad job on Apple's side. @JoeWHoward it's probably an expired signing certificate that causes the installation error, so changing the date fixes it. – Sedat Kapanoglu Oct 30 '19 at 00:06
  • 1
    ok, it works, but do you guys consider this a proper solution? This is a hack! – Kasper Oct 31 '19 at 14:24
  • Changing the date of the system will cause annoying issues to iCloud syncing, hands off and personal hotspot connection, etc. Don't forget to revert it back to normal afterward. – Mojtaba Hosseini Dec 09 '19 at 13:00
  • I don't know how, but this worked. Anyone know why? – Aaron Feb 20 '20 at 03:48
  • 2
    This works because the problem is that the Mobile bundles' cert expired - check the install.log and that's the error you see. It's a fine solution if you trust the cert even if it's old (I do) and you can set you clock back to normal afterward the install. I even tried to set the clock back during the install (I'm a risk taker) and other certs failed (fkcalendar?) but I was able to say accept them anyway and continue. – Michael Bushe Apr 19 '20 at 14:05
  • 1
    This is a much better answer than "derp update Xcode derp"... It is a hack, so what? The entire tech world is built on piles and piles of hacks. – xissburg May 19 '20 at 13:52
  • I can't believe this is still the solution. – ProGirlXOXO Aug 13 '21 at 06:41
  • Thank you, it worked, I was trying to download a bank application, but not able to do so. Now changed the date back to 2019 and installed successfully. – Avdhesh Solanki Aug 26 '21 at 08:44
220

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.

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.

S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
eja08
  • 4,600
  • 3
  • 13
  • 19
  • This is not necessary. See my answer below. – dmarnel Oct 30 '19 at 14:21
  • it worked after changing date. Do you know why this is happening? I updated app through app store – Amod Gokhale Oct 31 '19 at 13:52
  • 2
    The installation halted when the log mentioned "system_installd[8710]: kextcache: / locked; waiting for lock"; I set the time to the current time and the install continued. – Mark Dec 10 '19 at 13:37
58

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.

The package “MobileDeviceDevelopment.pkg” is untrusted.

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

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

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

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

Meraj al Maksud
  • 1,528
  • 2
  • 22
  • 36
valbu17
  • 4,034
  • 3
  • 30
  • 41
  • 1
    I had exactly the same problem against Xcode10.3 after installing Xcode11. I just did as you suggested by removing "MobileDeviceDevelopment.pkg" in "Xcode10.3/Contents/Resources/Packages" directory, then Xcode 10.3 launches immediately, even without asking any further required component installation that kept failing and prevented Xcode10.3 get launched. Can I ask you further details about your solution? Are there any chances of missing anything in terms of code-building by removing that package file? Much appreciated. – s4mt6 Nov 04 '19 at 03:34
  • 5
    I had the same problem when starting Xcode 10.3 when returning from my October vacation today. I found the path includes the "Packages" folder: …Xcode\ 10.3.app/Contents/Resources/Packages/MobileDeviceDevelopment.pkg Trashing MobileDeviceDevelopment.pkg worked for me, and Xcode did not want to install components. – Lewis Edward Garrett Nov 06 '19 at 16:48
  • 1
    @LewisEdwardGarrett if I had not read this comment, I'd have spent few more days struggling with this may be :D Thanks and Appreciate for the Packages correction – Lohith Korupolu Nov 08 '19 at 12:20
  • 1
    I tried that and got "The Xcode you are installing does not have the proper MobileDevice package. Please file a bug and try a different build of Xcode." – Victor Engel Dec 05 '19 at 16:24
  • 2
    Today is 03 Friday 2020 and this still workis, the path is different thou – André Pinto Jan 03 '20 at 14:05
  • Nobody should be outright deleting files unless you know _for sure_ that they are unnecessary. It's just as simple to back these things up rather than deleting them so you don't break something. – John Pancoast Apr 14 '20 at 01:32
51

At 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.

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

JBarros35
  • 976
  • 1
  • 12
  • 18
30

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:

All you have to is to upgrade Xcode

But there is a known Issues on apple developers site

Xcode may fail to update from the Mac App Store after updating to macOS Catalina. (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.


Always working solution for all Xcode issues:

  1. Go here and log in.

  2. Then download the xib from here.

More information here on this answer.


##Answer to this specific issue##

Get rid of those packages.

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

Xcode will install all of them again for you.

Mojtaba Hosseini
  • 95,414
  • 31
  • 268
  • 278
  • 3
    No idea why people upvote this answer. There are so many reason to have mutliple versions of XCode on your Mac. If one of those older versions doesn't run, apparently setting back the date is a solution. Upgrading is not. – Mark Dec 10 '19 at 15:35
24
rm -rf /Applications/Xcode.app/Contents/Resources/Packages/*.pkg

It will work and re-open the x-code

llinvokerl
  • 1,029
  • 10
  • 25
user12593755
  • 241
  • 2
  • 2
  • 1
    use "sudo" before the command it did not work for me without sudo. – bpolat Feb 04 '20 at 16:00
  • Is this command safe? It's assuming that all *.pkg files in that directory are safe to delete. I'd personally do something safer like backing up all pkg files like this. Just choose your value for backup_dir: `backup_dir="/my/pkg/backup-dir/"; mkdir ${backup_dir} && mv -R /Applications/Xcode.app/Contents/Resources/Packages/*.pkg ${backup_dir}` – John Pancoast Apr 14 '20 at 01:23
  • Since I cannot edit my above message, throw a `sudo` in front of `mv` unless you're already root. – John Pancoast Apr 14 '20 at 01:29
  • This fixed multiple issues I was having with Xcode + clang + ... + git + ... Yikes and thank you – learner Dec 26 '21 at 20:36
6

Try to run Xcode-beta instead of Xcode to install additional components. After that you'll be able to use Xcode release.

S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
Alex
  • 69
  • 3
5

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.

zkon
  • 568
  • 1
  • 6
  • 19
  • 1
    Yes, my problem was that after changing the time I was not able to update to Xcode 11.1, so I re-installed the whole app as you are suggesting and edited my answer – eja08 Oct 26 '19 at 10:06
0

Here's what I did to resolve:

Right click the xcode.app > show package contents > Contents > Developer > Platforms > iPhoneOS.platform > Device Support

I am on XCode 10.2.1. I had downloaded a 13.7 folder and contents from an external GitHub site and imported that folder into here for running my app on a physical iPhone Xr. I am prevented from upgrading to Catalina on my dev machine. Deleting the 13.7 folder and then re-launching XCode resolved the issue for me.

Will Buffington
  • 1,048
  • 11
  • 13
-1

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

-3

This requires Xcode 11.1 to be installed.

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.

dmarnel
  • 4,436
  • 1
  • 15
  • 11