Xcode freezes when running app after Yosemite update - xcode

After upgrading to Yosemite, Xcode has been unable to run apps on the device. Every time I click on the "Run" button or I do command-R, Xcode freezes. It installs the app on the device, but never launches it. It shows the busy spinning disc and stops responding. Even force quitting Xcode does not help. I have to restart the laptop in order to get Xcode to start again.
I tried it on several apps. These are apps I have been working on for months, it was working fine before Yosemite update.
Things I tried:
I tried installing Xcode 6.2 beta as well. The same happens on both old and new beta Xcode
Restarted the laptop several times.
Deleted and re-installed both versions of Xcode.
Tried running in non-fullscreen mode.
Check to make sure English is the primary language.
Cleared the DerivedData folder completely
Ran the following commands:
rm -rf $HOME/Library/Application Support/Developer/Shared/Xcode
rm -rf $HOME/Library/Preferences/com.apple.dt.Xcode.*
rm -rf $HOME/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState
rm -rf $HOME/Library/Developer/Xcode
None of the above seem to work. Why?

Delete the subfolders of Derived Data. Go to ~/Library/Developer/XCode/DerivedData (open the Finder, press cmd+G) and delete all the subfolders. Then restart Xcode. If that doesn't fix the issue, press cmd+shift+K to clean up your project from useless files.

Nothing really helped in the end. It just seemed to be a faulty incremental install on Yosemite, esp. since no one else seemed to face the issue. I couldn't even launch Xcode after sometime.
I just had to back stuff up and make a fresh install after formatting.

Related

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

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.

When launching an iOS simulator it closes straight away but still runs in the background

When I try to run a project (even a default single view app) in Xcode 10.2 (also occoured on Xcode 10.3 and beta 11 build 3) the simulator launches but then closes but Xcode still thinks it's running (looks like it is running headless). Any ideas on how I can see the simulator?
I have tried the following so far but the only time I can see the Simulator is on its first launch after that it disappears after launching.
Uninstalling and re-installing Xcode (making sure to delete all related directories and doing a system restart)
Adding and removing simulators from window -> Devices and simulators from within Xcode
Tried clearing the simulator cache xcrun simctl erase all
Tried running the following sudo killall -10 com.apple.CoreSimulator.CoreSimulatorService
Clearing Derived data ~/Library/Developer/Xcode/DerivedData/
Another thing I noticed is if I run: /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator I get the following error:
Bus error: 10
But if I run: sudo/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator the Simulator launches fine.
Thanks for any help.

Error running playground. Unable to find suitable target device. (iOS Swift)

I created a new project in XCode.
File > New > Playground (option+shift+cmd+N)
I restarted my XCode and also rebooted my system, but still same error.
From the developer forums, this worked for me:
Quit Xcode
Delete the folder /Users/<username>/Library/Developer/CoreSimulator/Devices. For example, in Terminal: rm -rf ~/Library/Developer/CoreSimulator/Devices
In Terminal: killall -9 com.apple.CoreSimulator.CoreSimulatorService (or just reboot).
Fox Xcode 7, I had to install iPad Air or iPad Air 2 for the playground to work.
Another possible way to encounter that issue is to get Xcode being auto-updated, while the simulator was launched.
The solution is like mentioned above but more polite:
Quit Xcode and Simulator app
Run in Terminal: killall -9 com.apple.CoreSimulator.CoreSimulatorService
Launch Xcode and find that all fixed now.
Sure, you can just reboot instead.
Try navigating to the Xcode Menu
Window >> devices (shift+cmd+2) a new window will pop up.
On the bottom left, add a new simulator, specifically one running on iOS 8.0 to the existing list.
Restart Xcode.
As referred by #Mayank Gupta , It worked on adding new simulator and restarting the XCode.

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

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