269

I'm running Xcode 4.3.1 iOS-Simulator which originally only supports iOS 5.1.

I need to test my code with iOS 4.3, so I used Xcode's "Install" feature to install it as described in "Installing Xcode with iOS 4.3 device simulator?"

Now I'm finished with testing but cannot find a way to uninstall the 4.3 portions ("iPhone 4.3 Simulator" and "iPad 4.3 Simulator"). I want to reduce the clutter in the Scheme menu.

No one on Apple's Xcode listserv knew the answer!

EDIT: note that much has changed since Xcode 4.3, so suggest anyone reading this look at all the answers. The newest ones such as Steve Moser's may be of more use to you!

EDIT 10/2017: Posted on Twitter by Julio Carrettoni‏

If you are an iOS developer, execute this:
$ xcrun simctl delete unavailable
It removes old simulators Xcode no longer use. For me it was 6Gb Did not try it myself...

[Also, I just saw Russ Bishop mentioned this in a comment below already...]

LinusGeffarth
  • 27,197
  • 29
  • 120
  • 174
David H
  • 40,852
  • 12
  • 92
  • 138

21 Answers21

233

In Xcode 6+ you can simply go to Menu > Window > Devices > Simulators and delete a simulator you don't need.

Roberto
  • 11,557
  • 16
  • 54
  • 68
tomi44g
  • 3,266
  • 1
  • 20
  • 28
  • 1
    The question was relevant in version 4 and probably 5. As you can see it was quite difficult. I avoided using older simulators since then myself. – David H Sep 23 '14 at 11:19
  • 3
    That is correct. If you want the simulators to be "really gone" or reinstall them in Xcode -> Preferences -> Downloads you have to delete the simulator runtime as pointed out below http://stackoverflow.com/a/30206853/1344293 – mathz May 21 '15 at 09:23
  • Thanks this is the easiest way to manage the simulators. instead of deleting the simulators from the xcode folders. This works for me :) – Chirag Sep 02 '15 at 07:04
  • How do you delete a device with an older iOS version? The devices window only shows simulators with iOS 9.1 (on Xcode 7.1). I would like to avoid editing device_set.plist and removing folders in Finder. – bio Oct 23 '15 at 08:22
  • You can also use this script to recreate simulators: https://gist.github.com/cabeca/3ff77007204e5479f7af – tomi44g Oct 24 '15 at 09:18
  • Correct, it will delete a simulator from Xcode. What it won't do is delete the simulator from your Mac to release the massive amounts of space they take up. –  Oct 04 '19 at 09:30
215

October 2020 update

As was mentioned, you can use xcrun to do a few things:

  • xcrun simctl list devices or xcrun simctl list --json to list all simulators
  • xcrun simctl delete <device udid> to delete specific device
  • xcrun simctl delete unavailable to remove old devices for runtimes that are no longer supported

More things you can do with xcrun (see code snippet)

- `xcrun simctl boot <device udid>` to launch (multiple) simulators
- `xcrun simctl io booted recordVideo — type=mp4 ./test.mp4` to record simulator video
- `xcrun simctl io booted screenshot ./screen.png` to make screenshot of simulator
- `xcrun simctl openurl booted https://google.com` to open URL in simulator
- `xcrun simctl addmedia booted ./test.mp4` to upload photo or video file (for photos app)
- `xcrun simctl get_app_container booted <your apps bundle identifier>` to find the app container (where identifier is like *com.bundle.identifier*)
- `xcrun simctl help` to explore **more** commands

Original Answer

September 2017, Xcode 9

Runtimes

You will find them here:

/Library/Developer/CoreSimulator/Profiles/Runtimes

enter image description here

Devices

To delete devices go here:

~/Library/Developer/CoreSimulator/Devices

Much easier to delete them use Xcode: Xcode->Window->Devices and Simulators enter image description here

Helping Xcode "forget" about runtimes and prevent from re-installing them - delete .dmg file(s) here:

~/Library/Caches/com.apple.dt.Xcode/Downloads

I hope it will help someone

Pavel Kovalev
  • 7,521
  • 5
  • 45
  • 67
  • 13
    Please do not delete devices from the filesystem; use `xcrun simctl delete `. You can also run `xcrun simctl delete unavailable` to remove old devices for runtimes that are no longer supported. – russbishop Oct 05 '17 at 05:29
  • 1
    I don't have ~/Library/Caches/com.apple.dt.Xcode/Downloads (no Downloads folder in ~/Library/Caches/com.apple.dt.Xcode/), wonder why – auspicious99 Jan 06 '18 at 16:41
  • 1
    the folder path you listed doesn't exist, Xcode 9.4 – Peter Cullen Jun 28 '18 at 22:59
  • This is what I was looking for: not deleting 12.2 simulated devices one-by-one, but delete the entire 12.2 simulator from the system. The path worked with XCode 10.3. After deleting, I had to restart it, and the count of the simulators just halved. – Display Name Jul 31 '19 at 08:45
  • I can't believe there isn't still just a "Delete" or "Uninstall" button in the IDE!..... – Karolina Hagegård Aug 21 '22 at 15:38
183

Did you try to just delete the 4.3 SDK from within the Xcode Package?

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs

please also delete the corresponding .dmg file in

~/Library/Caches/com.apple.dt.Xcode/Downloads

to prevent Xcode from re-installing the same package again.


for XCode >= 6 see @praveen-matanam 's answer

Evgeny Karkan
  • 8,782
  • 2
  • 32
  • 38
childno͡.de
  • 4,679
  • 4
  • 31
  • 57
  • This won't work in xcode 4.5.2. As soon as you start again the compiler it will ask you to install older legacy devices again. Cancel will quit xcode so you are forced to install again. – Alejandro Luengo Jan 16 '13 at 09:17
  • That's right Alejandro, Apple seems to have changed the "license thing" so that you always need a valid developer account and you have to install all extensions again and again on every major update within the app.. legacy systems are mostly unsupported too ;( – childno͡.de Jan 16 '13 at 09:20
  • @AlejandroLuengo do you know if this was fixed in 4.6? If not I'll put a bug report in. I've just studiously avoided installing any legacy devices since my first bad experience! – David H Jan 31 '13 at 21:32
  • 1
    See Dan Reese's answer below for something that works on Xcode 4.6. – BJ Homer Feb 01 '13 at 22:10
  • 2
    Worked for Xcode 6.3.1, along with this answer http://stackoverflow.com/a/30206853/286618. Cleared old documentation and saved 9GB!!! – RoLYroLLs May 31 '15 at 16:57
  • Good solution for old XCode version. For up-to-date version, check out Praveen's answer! – NDB Jan 05 '16 at 13:29
  • Still working as of September 2018, under macOS 10.13.6 and Xcode 10! – thiagoveloso Sep 23 '18 at 07:45
  • No such file or directory – ScottyBlades Jun 11 '22 at 00:10
168

In Xcode 6 and above, you can find and delete the simulators from the path /Library/Developer/CoreSimulator/Profiles/Runtimes. Restart Xcode in order to take effect (may not be needed).

Blaszard
  • 30,954
  • 51
  • 153
  • 233
Praveen Matanam
  • 2,773
  • 1
  • 20
  • 24
89

Run this command in terminal to remove simulators that can't be accessed from the current version of Xcode (8+?) in use on your machine.

xcrun simctl delete unavailable

Also if you're looking to reclaim simulator related space Michael Tsai found that deleting sim logs saved him 30 GB.

~/Library/Logs/CoreSimulator
Steve Moser
  • 7,647
  • 5
  • 55
  • 94
27

Xcode 4.6 will prompt you to reinstall any older versions of the iOS Simulator if you just delete the SDK. To avoid that, you must also delete the Xcode cache. Then you won't be forced to reinstall the older SDK on launch.

To remove the iOS 5.0 simulator, delete these and then restart Xcode:

  1. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/PhoneSimulator5.0.sdk
  2. ~/Library/Caches/com.apple.dt.Xcode

For example, after doing a clean install of Xcode, I installed the iOS 5.0 simulator from Xcode preferences. Later, I decided that 5.1 was enough but couldn't remove the 5.0 version. Xcode kept forcing me to reinstall it on launch. After removing both the cache file and the SDK, it no longer asked.

Dan Reese
  • 456
  • 4
  • 10
  • 1
    A slightly more precise answer [here](http://stackoverflow.com/a/11790983/209371), though I haven't tested it myself yet. – Dan Reese Feb 03 '13 at 16:14
26

I had the same problem. I was running out of space.

Deleting old device simulators did NOT help.

My space issue was caused by xCode. It kept a copy of every iOS version on my macOS since I had installed xCode.

Delete the iOS version you don't want and free up disk space. I saved 50GB+ of space.

enter image description here



NOTE -> can't you see ~/Library inside Finder? It is hidden by default. Use Terminal and type cd ~/Library/Developer/Xcode/iOS\ DeviceSupport/ or google how to see hidden folders.



NOTE -> if you have multiple users on a single macOS machine, make sure to find the directory ONLY with the user account that originally installed xCode.

rustyMagnet
  • 3,479
  • 1
  • 31
  • 41
  • I count 9G above - how did you recover 75G? – David H Sep 07 '17 at 12:04
  • hi @DavidH - 75GB was before my clean-up. As I have been working with xCode for years, xCode had silently installed every variant of iOS 7, 8, 9 and 10 on my machine. In reality I probably only need iOS10 and iOS11, going forward. – rustyMagnet Sep 07 '17 at 13:38
  • The folder does exist with xCode 9.4 @PeterCullen. You just have to access it from the user account who originally installed xCode. I have two user accounts on my Mac that share xCode. Only the user account that installed xCode can view this folder. – rustyMagnet Jun 29 '18 at 07:26
  • I am accessing it with the account that installed Xcode. It's not there. – Peter Cullen Jun 29 '18 at 23:44
  • 1
    are you opening Finder and selecting "Go to folder"? Library is a hidden folder, by default. – rustyMagnet Jun 30 '18 at 07:25
  • 1
    I ran `xcrun simctl delete unavailable` as suggested in other answers but that didn't delete the actual iOS versions. Thanks for the tip, there were a bunch of old/in-between ones in that folder! Btw, there's an app called "DevCleaner" in the app store that lists everything and can also delete specific ones (including old logs and archives). – Neph Feb 25 '21 at 14:09
22

macOS Ventura 2023

Same as the previous version search storage in your spotlight search tool and then double click the Developer option.

The interface looks a bit different now

enter image description here

macOS Big Sur & Monterey before 2023

We can use the Storage Management tool: ⌘ + Space bar and search storage.

Under Developer: you can find Xcode Cache and build files and also old version of iOS support files that you can delete.

enter image description here

Tested on macOS Big Sur & Monterey

eggsloveoats
  • 453
  • 4
  • 14
11

following some of the answers here, deleting some simulators from my Xcode Menu > Window > Devices > Simulators did nothing to help my dying disk space: enter image description here

however, cd ~/Library/Developer/Xcode/iOS\ DeviceSupport and running du -sh * I got all of these guys:

2.9G    10.0.1 (14A403)
1.3G    10.1.1 (14B100)
2.9G    10.3.2 (14F89)
1.3G    10.3.3 (14G60)
1.9G    11.0.1 (15A402)
1.9G    11.0.3 (15A432)
2.0G    11.1.2 (15B202)
2.0G    11.2 (15C114)
2.0G    11.2.1 (15C153)
2.0G    11.2.2 (15C202)
2.0G    11.2.6 (15D100)
2.0G    11.4 (15F79)
2.0G    11.4.1 (15G77)
2.3G    12.0 (16A366)
2.3G    12.0.1 (16A404)
2.3G    12.1 (16B92)

All together that's 33 GB!

A blood bath ensued

see more details here

DawnSong
  • 4,752
  • 2
  • 38
  • 38
abbood
  • 23,101
  • 16
  • 132
  • 246
6

In addition to @childno.de answer, your Mac directory

/private/var/db/receipts/

may still contains obsolete iPhoneSimulatorSDK .bom and .plist files like this:

/private/var/db/receipts/com.apple.pkg.iPhoneSimulatorSDK8_4.bom /private/var/db/receipts/com.apple.pkg.iPhoneSimulatorSDK8_4.plist

These could make your Downloads tab of Xcode's preferences show a tick () for that obsolete simulator version.

To purge the unwanted simulators, you can do a search using this bash command from your Mac terminal:

sudo find / -name "*PhoneSimulator*"

Then go to corresponding directories to manually delete unwanted SimulatorSDKs

Raymond
  • 1,172
  • 16
  • 20
6

In XCode open Window - Devices, then select and remove the outdated simulators.

Display Name
  • 4,502
  • 2
  • 47
  • 63
4

I wrote up one-line bash script that would delete ALL your simulators:

xcrun simctl list devices | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})" | xargs -L1 xcrun simctl delete
  • xcrun simctl list devices will list all the simulators installed on your machine
  • grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})" will grab the device UUID
  • xargs -L1 xcrun simctl delete will attempt to delete the device for each UUID it found

If you want to see everything it'll execute, you can add echo before xcrun, i.e.

xcrun simctl list devices | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})" | xargs -L1 echo xcrun simctl delete
Toland Hon
  • 4,549
  • 2
  • 32
  • 36
4

Some people try to fix it using one way, some the second. Basically, there are 2 issues, which if you check them out & solve both - in 99% it should fix this issue:

  1. Old device simulators located at YOUR_MAC_NAME (e.g. Macintosh) -> Users -> YOUR_USERNAME (daniel) -> Library -> Developer -> Xcode -> iOS Device Support. Leave there, the newest one, as of today this is 13.2.3 (17B111), but in future it'll change. The highest number (here 13.2.3) of the iOS version indicates that it's newer.

  2. After this list your devices in Terminal by running xcrun simctl list devices. Many of them might be unavailable, therefore delete them by running xcrun simctl delete unavailable. It'll free some space as well. To be sure that everything is fine check it again by running xcrun simctl list devices. You should see devices only from the newest version (here 13.2.3) like the screenshot below shows.

enter image description here

As a bonus which is slightly less relevant to this question, but still free's some space. Go to YOUR_MAC_NAME (e.g. Macintosh) -> Users -> YOUR_USERNAME (e.g. daniel) -> Library -> Developer -> Xcode -> Archives. You'll see many archived deployed application, most probably you don't need all of them. Try to delete these ones, which are not being used anymore.

Using these 2 methods and the bonus method I was able to get extra 15 GB of space on my Mac.

PS. Simply deleting simulators from Xcode by going to Xcode -> Window -> Devices and Simulators -> Simulators (or simply CMD + SHIFT + 2 when using keyboard shortcut) and deleting it there won't help. You really need to go for the described steps.

Daniel Danielecki
  • 8,508
  • 6
  • 68
  • 94
4
  1. Open Xcode --> Go to Window (from menu bar) --> Devices and Simulators --> Click on Simulator --> Right-click on the simulator that you want to delete --> Click Delete

  2. To delete any unwanted simulators that you installed in the past as an extra Component through Xcode.

  • Open Terminal

  • Type open /Library/Developer/CoreSimulator/Profiles/Runtimes

  • Delete undesired simulators

Sandesha
  • 51
  • 4
3

Another thing you can do is to change the Deployment target to the highest value. This will prevent the Scheme Menu from displaying older versions.

To do this go to: Target->Summary then change the Deployment Target.

werdsackjon
  • 394
  • 4
  • 11
  • Maybe things changed since I posted the question, but when I did, you would see the different simulators in the Scheme menu, and it just complicated choosing the right one. – David H Jun 24 '13 at 20:51
3

I tried all answers. None of them worked for me.

What worked for me on Sierra + Xcode 8.2 was going to:

/Library/Developer/CoreSimulator/Devices and deleting all devices.

(Maybe this won't work for you, maybe this is a solution as a standalone, or maybe you have to do this in addition to other answers, but I did all solutions here and so not sure what did the deed). Just be aware that some of the answers here are old and the location of simulator has changed. Snowcrash's answer seems to be most recent.

Community
  • 1
  • 1
mfaani
  • 33,269
  • 19
  • 164
  • 293
  • Can I assume you shut Xcode down first, did this, then restarted Xcode? – David H Apr 19 '17 at 17:52
  • @DavidH sorry I don't remember what I did. I had the issue for 3-4 weeks. Each time it was happening when I was switching between projects/sim-devices...I just tried everything and this seemed to do it for me...again it could something else for you – mfaani Apr 19 '17 at 17:55
  • @DavidH did you also try [this answer](http://stackoverflow.com/a/30206853/5175709) – mfaani Apr 19 '17 at 17:57
  • For Xcode 10 and newer the folder is: `~/Library/Developer/CoreSimulator/Devices`. – blackjacx Nov 17 '18 at 13:46
3

UPDATE Xcode 14

In Xcode 14, you can finally uninstall Simulator runtimes via the "Platforms" section in settings. Just select one and hit the minus "-" button in the lower left corner.

Micky
  • 5,578
  • 7
  • 31
  • 55
  • 1
    Handy, but note that it doesn't cover the extra support files (and of course not the caches and project build files) as noted in https://stackoverflow.com/a/69623427/954643. And if one wants to go that far in wiping files, you should also wipe unneeded data in `~/Library/Developer/CoreSimulator/Devices/` with `xcrun simctl delete unavailable` to remove the Devices whose runtimes you removed with this setting feature, which can free up gigabytes of space depending on how aggressively you use multiple runtimes and devices. – qix Oct 20 '22 at 10:16
2

The problem with these answers is that, with every Xcode update, menus and locations will change.

Just go to /Applications/Xcode.app/Contents/Developer/Platforms and delete what you don't need. Xcode will start fine. If you're at all concerned then you can simply restore from Trash.

Snowcrash
  • 80,579
  • 89
  • 266
  • 376
  • 2
    I seriously doubt that Xcode downloads simulators you request it its bundle. Surely they go into the users library, no? That said, I have never downloaded an older one since I had my issue with Xcode 4. – David H Oct 10 '16 at 12:47
  • For each Platform (iOS, watchOS, AppleTVOS, MacOS) I have 2 folders: I have "iPhoneOS.platform" & "iPhoneSimulator.platform" Which one am I suppose to delete? I checked with colleague, he had exactly both of them but no issue.The reason I'm actually here is because of [this issue](http://stackoverflow.com/questions/39856001/xcode-8-beta-simulator-fails-to-run-app-after-accidentally-running-xcode8-simula) and someone told me it's because I have 2 simulators/Xcodes, but If I've dont it correct I've deleted my other version of Xcode and also I've deleted the 9.3 runtime... – mfaani Apr 13 '17 at 16:20
  • 1
    Please please please do not do this. No one should be messing with content inside the Xcode bundle. – russbishop Oct 05 '17 at 05:30
1

On Mac, check /Library/Developer/Xcode/iOS\ DeviceSupport

iOS DeviceSupport

Dima Kozhevin
  • 3,602
  • 9
  • 39
  • 52
Sandesha
  • 51
  • 4
  • 1
    Current versions of Xcode use a slightly different location: `/Library/Developer/CoreSimulator/Profiles` – Andrew Sep 11 '20 at 00:31
1

You can use the following snippet to delete unavailable runtimes:

echo "rm -rf $(xcrun simctl list runtimes -j |\
      jq ".runtimes[] | select(.isAvailable|not) | .bundlePath" | xargs)"

to execute, remove echo or add | bash at the end.

If you don't have jq command available, you can get it using brew install jq

Guy Mazuz
  • 437
  • 1
  • 4
  • 18
-2

Command+Space

Type 'simulator'

open the old beta simulator you no longer need.

right-click on it in the dock, then choose Options>'Show in Finder'

Close the app, then remove it from the folder.

:)

Samer
  • 3,848
  • 4
  • 25
  • 24