XCode using GUID instead of iOS version number in Simulator Selection - xcode

Somewhere during the various updates of XCode in the last month, the iOS versions dropped from my simulator selection (image below.) Anyone know how to resolve this?

How to fix it
Xcode uses the device version to disambiguate devices with the same name.
If two devices have the same name and version number, it will use the devices' UDIDs.
You have 4 of each of a bunch of devices (eg iPhone 5s). I suspect that some of them are for the same iOS version. You should delete some of the duplicates. Check out xcrun simctl list and xcrun simctl delete or use the device manager within Xcode.app (click on the "-" to delete a device).
How to just get back to a default state
# Ensure all possible clients of CoreSimulatorService are no longer running:
killall Xcode 2> /dev/null
killall Instruments 2> /dev/null
killall 'iOS Simulator' 2> /dev/null
killall Simulator 2> /dev/null
killall 'Simulator (Watch)' 2> /dev/null
killall ibtoold 2> /dev/null
killall simctl 2> /dev/null
# There may be others
# Kill the service itself
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
# Remove all the data and logs
rm -rf ~/Library/*/CoreSimulator
Why this might be happening:
CoreSimulatorService will monitor for the addition of new simulator runtimes in /Library/Developer/CoreSimulator/Profiles (eg, for when downloading them from Xcode -> Preferences -> Downloads). When installing a new runtime, CoreSimulatorService will create an initial set of devices for that runtime.
This problem arrises if there are multiple instances of CoreSimulatorService running at the same time. Each CoreSimulatorService instance will create its own set of devices (but its clients will only see that instances's sets at first). On subsequent launches (eg: after a reboot), both copies will be seen. One can get into a state where multiple copies of CoreSimulatorService are running at the same time due to testing beta versions of Xcode.app in the same login session as using the released Xcode.app or by having used Xcode.app before and after updating it through the App Store.
If you are aware of any other way that this bug might come about, please file a new radar at http://bugreport.apple.com

Deleting multiple copies of the same version from the Devices window did the trick for me.

I found this script to be the most efficient. I clears the list of existing simulators, than rebuilds it based on installed platforms.
See https://gist.github.com/cabeca/cbaacbeb6a1cc4683aa5

Related

Why does my Xcode 8 GM have 50+ Simulator versions to choose from?

How can I fix this? I have 2.5 full pages of this:
Go into Window -> Devices. Then just select the Simulators you don't want and delete them (by hitting the Delete key, or right-clicking).
You can also un-select the "Show in Run Destinations Menu" item (when you right-click).
There was a bug in one of the earlier betas which could have caused extra devices to get created. The easiest thing to do is get back to a vanilla state. Quite Xcode.app, Simulator.app, etc and then run:
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
rm -rf ~/Library/*/CoreSimulator

Install iOS simulators from the command line

I have a CI setup with multiple slaves. I'd like to install different versions of the iOS simulator, but this needs to be done from the Downloads tab in the Xcode Preferences. Ideally there would be a command line tool that we could run to download and install specific versions. Does this exist?
If you don't care about having the system keep track of the package receipts, you can just install them on one of your systems and then rsync /Library/Developer/CoreSimulator/Profiles/Runtimes over to the other systems.
Note that after the transfer, I'd suggest doing 'sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService' on the other slaves since the service expects the profiles to be moved into place and might not respond well to the rsync.

Xcode won't start, stuck on 'Verifying "Xcode"...'

I've installed Xcode on a mac and when I try to start it I get a little window open saying 'Verifying Xcode' with a status bar scrolling across, anyone got a fix rather than reinstalling?
If you don't want to wait forever, this might help:
xattr -d com.apple.quarantine '/Applications/Xcode.app'
Running a command to get through Gatekeeper sounds like the way to go, since you downloaded it from a trusted source. This is a common occurrence when installing large bundles in Mac OS X. Basically, Gatekeeper examines your entire bundle, making sure that there is no suspicious code. This is one of the many things that keeps Mac OS X as secure as it is. You have two options:
1: Give it time.
Or,
2: Manually tell Gatekeeper "It's okay, this is from a trusted source". How do we do this? Well, first fire up the Terminal and navigate to your Xcode.app folder. (Or type in cd and drag-and-drop Xcode from your applications folder), then hit enter.
Next, run the command:
xattr -d com.apple.quarantine Xcode.app
Now, be careful getting past Gatekeeper if whatever you are installing is even slightly from an untrusted source, or else you introduce a security risk to your computer. In my case, opening new versions of Xcode quickly is the only time I will ever run that command.
anyone got a fix rather than me reinstalling?
For anyone else seeing a very long "Verifying Xcode" phase, just give it time. The indeterminate progress bar stays up there for a long time (tens of minutes) while Gatekeeper looks at the (very large) Xcode bundle to make sure that it's legit. Eventually, you'll get the familiar message along the lines of "This application was downloaded from the Internet. Do you want to continue?" Or, if the bundle doesn't check out, you'll of course get a message to that effect.
Almost every answer here recommends running xattr -d on the file. This deletes the file's extended attributes (like com.apple.quarantine) so OSX will not run the verification phase. You should only do this as an absolute last resort if at all. Apple explicitly recommends leaving Gatekeeper enabled to validate your version of Xcode after XcodeGhost malware was spread to popular iOS apps via infected versions of Xcode.
If you're stuck trying unarchive an Xcode beta .xip archive, try this:
Open the Archive Utility app. (Open Finder by hitting ⌘+spacebar and type "Archive Utility")
Choose File->Expand Archive and select the Xcode archive.
I had same issue. Quick fix is to open terminal from application or type terminal in spotlight and enter below command.
cd /Applications - This will move to applications directory where Xcode is present
xattr -d com.apple.quarantine Xcode.app - This will bypass Gatekeeper in OS X and will launch Xcode quickly
Note: If you have changed name of Xcode (say Xcode7-1) then you should enter ... Xcode7-1.app command. Refer screenshot
open terminal -
1.Type cd drag drop your xcode (for path) then enter
2.next xattr -d com.apple.quarantine Xcode.app enter
agree for terms and condition
For Xcode 8:
To skip the verifying process on El Capitan for Xcode 8, download Xcode 8 at the developer downloads page, then open terminal.
Following this, type
xattr -d com.apple.quarantine
Then drag your xcode 8 download into your terminal window.
It should look like this:
A lot of talk here about exempting Xcode-beta.app from Gatekeeper, but for me, I had to make the .xip file exempt.
I placed Xcode_8_beta_6.xip into /Applications, then in Terminal, changed directory to /Applications and ran:
xattr -d com.apple.quarantine Xcode_8_beta_6.xip
Then double clicked the .xip to get it to unpack.
running xattr -d com.apple.quarantine Xcode.app worked like a charm. Waiting on the "verifying xcode" didn't work, as it never completed.
Also you can remove Open Warning for entire directory Applications via the command in the terminal:
xattr -d -r com.apple.quarantine ~/Applications
it's work for me:
open Terminal cd to path Xcode.app
xattr -d com.apple.quarantine Xcode.app
You can try the command:
xattr -r -d com.apple.quarantine /your_path_to_xcode/Xcode.app
If you do not use -r, you will have to run the same command for the iOS simulator later on. I am not sure what other executables are hidden in this bundle and are quarantined.
If you have time, the recommended method is to leave the verification to complete so that everything is verified properly.
I had the same issue (Macbook Pro, Mid 2015, OS X 10.11.15) and was able to fix it without using the terminal to bypass Gatekeeper:
Trash all previously downloaded versions of the file and empty the trash. (If you haven't emptied your trash in forever this may take a long time. You can selectively delete the offending .xip files manually to save time.) I found multiple instances that would not delete because they were currently in use.
Restart your computer. Now you should be able to delete any .xip files in the trash without issue.
Download the Xcode8 beta again (don't stream media while doing this to save on time and packet loss.) and open it.
If this doesn't do the trick, open up terminal and follow one of the answers above.
Run the following command making sure this is your Xcode's location on the system & replace the xcode name with actual name which code be xcode2 or Xcode 3 incase if you have more versions of Xcode on your machine..
All the best ..
xattr -d com.apple.quarantine Xcode.app
Just wait for process to get over with.. sometimes it takes longer than the usual time but ends up showing the alert boxes for next process! sit back let it finish. :)
If you are not logged in to Xcode try logging in with any Apple account.

kill iOS Simulator from terminal

I'm trying to terminate the iOS Simulator from the terminal console (needed for integrating automatic UI Testing in Jenkins),but every time I try the command:
killall SimulatorBridge
a prompt waiting for action gets displayed:
The problem is that the simulator doesn't get dismissed until an action on the prompt is taken. How to get rid of it?
The proper way to shutdown simulators is xcrun simctl shutdown all.
I don't recommend shutting down simulators by killing CoreSimulator.
Simulator.app is just a viewer (as of Xcode 9). It does not need to be launched and so does not need to be shut down either. It will respond to devices booting and shutting down automatically.
You can also hold down Option when quitting to detach from running simulators without shutting them down. Check the checkbox to make that the default behavior.
Similarly you can hold down Control when closing a window via File, Close to get a similar choice when closing a single simulator's window.
Use killall "iPhone Simulator"
With XCode 6, use killall "iOS Simulator" (thanks #gempewsaw)
With XCode 7, use killall "Simulator" (thanks #Stanislaw)
With XCode 8, killing the Simulator process is sometimes not enough, also need to kill process com.apple.CoreSimulator.CoreSimulatorService (thanks #bensnider)
I agree with the answers above. Just wanted to add that I noticed my Jenkins job was failing when there was no simulator to kill. I got around this by adding it like this:
killall "iOS Simulator" || echo "No matching processes belonging to you were found"
Good luck with your ci!
Please try
killall -9 "iPhone Simulator"
You can kill Simulator running from commandline.
killall "Simulator" || true

How to fully remove Xcode 4

I want to remove all existing SDK versions as well as Xcode 4.
Xcode 4 Guide says to do this:
sudo /Xcode4/Library/uninstall-devtools --mode=all
But I don't have Xcode4 at this location and the only place I see it is under /Developer/Applications
I've already run the uninstall-devtools that was previously found in /Developer/Applications and then did a reinstall.
What else can I do to completely remove everything and start from scratch?
I use this command:
sudo /Developer/Library/uninstall-devtools --mode=all
Edit (1 year later):
If you've downloaded Xcode from the App Store, it's self-contained, as #mediaslave suggests. You can just drag it to the trash or use AppZapper (or a similar utility) to remove the developer tools.
If you're looking to update it, you can also do that straight through the App Store.
sudo /[xcode-path]/Library/uninstall-devtools --mode=all
Normally, [xcode-path] means /Developer, but if you have multiple versions, for example 3 is the first installed, 4 is second, /Developer will be xcode 3's root derectory and /Xcode4 for xcode 4.
Ensure Xcode, iOS Simulator, and the Mac App Store apps aren't running, then trying running the uninstall script at this (different!) location:
/Library/Developer/Shared/uninstall-devtools
This is where I found it.
Also delete Install Xcode.app from Applications folder, and Empty Trash.
Then run App Store again, and find/install Xcode.
su (or sudo su, whatever)
find / -name uninstall-devtools
This will reveal where the utility is...
If you have XCode 4.3.1, just Move To Trash the XCode.app file in the Applications folder.
If you have installed xcode from Mac App store, then you need to delete it from Launch pad. You can do this by locating xcode icon in launch pad, long click on the icon till it starts dancing. Then delete it and wait for a while till the xcode.app is deleted from /Application. If you manually delete xcode.app from /Application, App store will continue to think its installed and will not allow you to reinstall in future.
I tried to uninstall this by deleting it, but the AppStore still thought that it was installed. I deleted some preferences files in my /private directory, which made the AppStore "forget" that I had installed Xcode. I used the following command:
sudo find / -iname '*xcode*' 2> /dev/null | egrep '^/private.*' | xargs -I file sudo rm -rfv file
Which deleted the following files from my computer:
/private/var/db/receipts/com.apple.pkg.XcodeMAS_iOSSDK_6_1.bom
/private/var/db/receipts/com.apple.pkg.XcodeMAS_iOSSDK_6_1.plist
/private/var/folders/7d/n34963zx62s7znxyzn3dn6bh0000gq/C/com.apple.Xcode.503/CachedSpecifications-Xcode
/private/var/folders/7d/n34963zx62s7znxyzn3dn6bh0000gq/C/com.apple.Xcode.503/CachedSpecifications-xcodebuild
/private/var/folders/7d/n34963zx62s7znxyzn3dn6bh0000gq/C/com.apple.Xcode.503
I do not know what these files are used for, but it made the AppStore forget that it was installed, which is what I needed to happen. In my case, the AppStore was not allowing me to update to the new version of Xcode.

Resources