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

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
}
}
}*

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

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.

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!

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.

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:
Go here and log in.
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.

rm -rf /Applications/Xcode.app/Contents/Resources/Packages/*.pkg
It will work and re-open the x-code

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

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.

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.

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

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.

Related

How do you update Xcode on OSX to the latest version?

What is the easiest way to update Xcode on OSX?
I see this in the terminal:
$ brew install xxxxxxx
Warning: Your Xcode (4.3.3) is outdated
Please install Xcode 4.6.
But when I go to open up Xcode > Preferences > Downloads, it says there are no updates?
Open up App Store
Look in the top right for the updates section (may also be in lefthand column "Updates"..)
Find Xcode & click Update
softwareupdate --list see the list of outdated software.
softwareupdate --install --all update all outdated software.
softwareupdate --install <product name> update the software you named.
Sometime I don't see the Xcode update in Updates tab in AppStore
So I search Xcode in AppStore
Then click update and it update
If attempting to download via the App Store leaves you with a little grey spinner and nothing actually happening, then you can go to :
https://developer.apple.com/download/more/
log in with your Apple Developer ID, and the latest Xcode should be available as a .zip download.
In my case (Xcode 6.1, iOS 8.2) I did not see the update in AppStore.
I found Xcode 6.2 for download and pressed "Install".
Then, it installed and asked for the update (more than 2 Gb).
Xcode 6.2 works correctly with iOS 8.2 and iOS 8.1.2
Hopefully this tip will help somebody else...
xcode-select --install worked for me
Another best way to update and upgrade OSX development tools using command line is as follows:
Open terminal on OSX and type below commands. Try 'sudo' as prefix if you don't have admin privileges.
brew update
and for upgrading outdated tools and libraries use below command
brew upgrade
These will update all packages like node, rethinkDB and much more.
Also, softwareupdate --install --all this command also work best.
Important: Remove all outdated packages and free some space using the simple command.
brew cleanup
If you want the latest Beta, it will not be in the AppStore. Instead you have to login to https://developer.apple.com and download from there.
In my case I solved this "no updates" issue by accessing AppStore from the developers link:
https://developer.apple.com/download/release/
Apart, you might find this command useful: mas-cli-github
$ brew install mas
$ mas list
$ mas search Xcode
$ mas install <id>
$ mas upgrade <id>
I ran into this bugger too.
I was running an older version of Xcode (not compatible with ios 9.2) so I needed to update.
I spent hours on this and was constantly getting spinning wheel of death in the app store. Nothing worked. I tried CLI softwareupdate, updating OSX, everything.
I ultimately had to download AppZapper, then nuked XCode.
I went into the app store to download and it still didn't work. Then I rebooted.
And from here I could finally upgrade to a fresh version of xcode.
WARNING: AppZapper can delete all your data around Xcode as well, so be prepared to start from scratch on your profiles, keys, etc. Also per the other notes here, of course be ready for a 3-5 hour long downloading expedition...
You DO NOT need to upgrade Xcode.
Just open the file /usr/local/Homebrew/Library/Homebrew/extend/os/mac/diagnostic.rb ,
then remove this line check_xcode_minimum_version in the following function.
def fatal_build_from_source_checks
%w[
check_xcode_license_approved
check_xcode_minimum_version //<-- this one
check_clt_minimum_version
check_if_xcode_needs_clt_installed
].freeze
end
Then brew install should works fine.
I used the Command_Line_Tools_OS_X_10.XX_for_Xcode_7.2.dmg and therefore had to download the latest version from here.
Check https://xcodereleases.com/ where you can also download legacy versions.
For me it was >41GB for the update to start. ~/Library contains a lot of cached content for mail, browsers, etc...you can safely remove those. Remove big apps too, like iMovie..you can always install it back later

Uninstalling Xcode 3.2.6 from Lion 10.7.2

I've installed xCode 3.2.6 on my Lion 10.7.2.
After install I can't find the xCode icon to launch it. I've got to know 3.2.6 doesn't support Lion.
However, the worst thing happen when I tried to uninstall it with
sudo /Developer/Library/uninstall-devtools --mode=all
Unfortunately uninstall-devtools wasn't there. I'm stuck middle of nowhere.
Does anybody have any idea how to uninstall it and install xCode 4.2?
Following command fire on terminal and remove the all files and folder of xcode
sudo /Developer/Library/uninstall-devtools --mode=all
also more information and show log of the uninstal so go refrence link here
If /Developer/Library/uninstall-devtools does not exist skip that step.
Delete the /Develop folder if it exists.
Install xCode 4.2. Th eXcode icon will be in /Developer/Applications
The Xcode latest beta is even easier to install, get it if you have access.
If you install Xcode 3 from the GUI on Lion, you'll end up with a bunch of random tools but not the actual Xcode Toolset. In that case, you can use the uninstall-dev-tools located in /Library/Developer/Shared (rather than /Developer/Library).
You can fully install XCode 3 on Lion via the Terminal with the following commands:
export COMMAND_LINE_INSTALL=1
open "/Volumes/Xcode and iOS SDK/Xcode and iOS SDK.mpkg"
careful: if you work in ruby, you better stay with xCode 4.1

Xcode says I have 4.2 installed, but only 4.1 opens

I'm confused about this. When I go on the market or try to download 4.2 to get ios5 it says that it is Installed. I check my Xcode in the about section and it says it is running 4.1. I tried this Install Xcode that is in my applications folder assuming maybe it was for the update and it still shows 4.1. How do I update my xcode?
In your Applications folder, there is an app called Install Xcode. Run that to actually install Xcode4.2 after the App Store finishes downloading the upgrade. Weird, unexpected process, I know.
I had the same problem. After reading the answers here I looked for the "Install Xcode.app" file in the /Application directory and it wasn't there. It turns out that I had moved the "Install Xcode.app" bundle out of /Applications after I installed Xcode 4.1 (I didn't think it would be used again). I used Spotlight to remind me where I had moved it to and I ran it again and it updated the files. Now Xcode reports it is at version 4.2 like I expected. This is not at all like any other Apple installs. I wonder why they did it this way.
The App Store doesn't upgrade Xcode 4.1 to Xcode 4.2 for you like it does for all other apps. Instead, it just downloads an installer/upgrader which gets placed in your Applications folder, and proceeds to not tell you anything about it, hoping you can read its mind. To upgrade, you have to do this:
Download the update via App Store.
Manually upgrade by running: /Applications/Install Xcode
Another way to do an upgrade will be to manually remove Xcode 4.x first:
Delete Xcode: $ sudo rm -r /Developer (takes about 20 minutes to finish)
Delete any "Install Xcode" files from your Applications folder.
Download Xcode 4.2 from the App Store.
When finished, install it: Applications ---> Install Xcode
Re-download all Xcode Documents and Components: Xcode ---> Preferences ---> Downloads
That's the most extreme way of doing things. If you added anything to your /Developer folder, you should back it up before running the rm -r command, as that will delete EVERYTHING in it.
Your Xcode preferences will remain in-tact, as they're stored in ~/Library/Application Support/Xcode/ and ~/Library/Preferences/com.apple.dt.Xcode......plist
follow the instructions given in http://simplecodebits.blogspot.com/2011/10/update-to-xcode-42-in-mac-osx-lion.html

How do i install additional packages for Xcode on OSX Lion to allow MacPorts to work

When I try and install MacPorts it complains
'Xcode is not installed, or was installed with UNIX Development (10.5+) or Command Line Support (10.4) deselected.'
I do have Xcode installed from the Appstore so I guess I just have to install these extra parts but how ?
Ive read a couple of questions on Stack Overflow about this but I think the answers must be outdated as they do notmake sense for me, I do not have an Xcode dmg I can reinstall from, and I can't see anything useful in /Developer either, or any preferences within Xcode itself.
I only want Xcode for the purposes of using Macports so I'm not familiar with it.
You probably got Xcode 4.1 from the Mac App Store. In that case, you haven't got Xcode 4.1 installed. However, you now have an Xcode installer in your Applications directory.
Spotlight should find it in any case.
The command line tools aren't included in the default install of Xcode anymore.
Goto the Xcode Preferences --> Downloads Pane --> click the Install button beside "Command Line Tools".
If you don't have Xcode installed you can get the command line tools separately as explained here..
http://osxdaily.com/2012/07/06/install-gcc-without-xcode-in-mac-os-x/
The App Store installs the XCode installer, not Xcode itself. The installer is in your applications folder. Run that.
Today, 16 Feb 2012, when I installed Xcode 4 from the App Store, there was no Setup. Just the app installed, because it was Xcode 4.3 !
Make sure that you install Xcode 4.2 with UNIX Devel. to MacPorts works!
To get the Xcode 4.2 go to https://developer.apple.com.

Xcode 4.1 can't reinstall. App store says "installed"

Today i update my system to Lion and try to update Xcode.
After downloading from app store i get error.
So i remove my old Xcode 4.0 by this command
/Developer/Library/uninstall-devtools –mode=all
But now in app store i have the status "installed" and can't reinstall my Xcode.
So what i must do?
p.s Trash is clear.
When I downloaded Xcode from the Mac App Store it created an Icon in launchpad called 'Install Xcode' and you're able to kick off the install from there.
My installation failed the first time and I was able to reinstall fine.
sudo /Developer/Library/uninstall-devtools –mode=all
sudo rm -rf /Developer*
sudo rm -rf /Applications/*Xcode.app
Download & Install "Install Xcode.app" or now just "Xcode.app" from the AppStore again, and run it.
Try a spotlight search for Xcode. I found an Xcode installer app in my applications folder when I did that.
Delete "Applications/Install Xcode" you can then re-install from app store
I had the same problem with other app. Deleted it and could not install again from App Store. The problem was that I had backup copy on the mounted external disk. After I have un mounted the disk with the other copy, App Store let me download the app again. Regarding to what verylastminute wrote - if Appstore can "see" any other duplication file it will not let you re-download.
open terminal window
cd /Applications
sudo rm -rf Install\ Xcode.app
After that you should be able to reinstall
I had a similar problem - clicking on Install in the Mac App Store did absolutely nothing. No error messages, no downloads, no install.
I had to all of the following to get the Xcode install to work:
rm ~/Library/Preferences/com.apple.appstore.plist
rm -r ~/Library/Saved\ Application\ State/com.apple.appstore.savedState
rm -r ~/Library/Caches/com.apple.appstore
rm -r /private/var/folders/*/*/*/com.apple.appstore
Then I deleted my existing '/Developer/Xcode.app', and an existing '/Applications/Install Xcode.app' from a previous version. Even then it didn't work until I restarted my machine!
If you have moved the Install XCode file anywhere else, and even if you have renamed it, Spotlight still shows it being in both the new location and in Applications. You need to delete any duplicates you may have made of the file before App Store will let you download it again.
I had a similar issue. I resolved it by creating another admin account on the computer. Then I installed Xcode using the new admin account.
You haven't installed Xcode, not yet. It's confusing, especially when trying to downgrade from Xcode 4.2 to Xcode 4.1 on Lion, but since the migration to App Store Xcode installs, you "install" the install app, which you then have to run to install xcode.
You've installed "/Applications/Install Xcode.app"
You need to run this to actually get "/Developer", gcc, make, etc
Simple solution : on App Store, instead of going in updates or in installed apps, simply go to "Bought apps" page. On this page, you have the option to update Xcode.
After I have tried all suggestions from this and other forums I finally managed to solve the problem in the following way: I went to the App Store menu Store -> View My Account and it was only there that I saw XCode as available with an "Install" button. Hope this helps.
In my case, on macOS 12.2 Monterey with M1 chip, there was no "Install Xcode" directory. I ran this instead and it worked:
rm -rf /Applications/Xcode.app

Resources