Xcode Simulator: how to remove older unneeded devices?
IosXcodeIos SimulatorIos Problem Overview
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...]
Ios Solutions
Solution 1 - Ios
In Xcode 6+ you can simply go to Menu > Window > Devices > Simulators and delete a simulator you don't need.
Solution 2 - Ios
October 2020 update
As was mentioned, you can use xcrun
to do a few things:
xcrun simctl list devices
orxcrun simctl list --json
to list all simulatorsxcrun simctl delete <device udid>
to delete specific devicexcrun 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) simulatorsxcrun simctl io booted recordVideo — type=mp4 ./test.mp4
to record simulator videoxcrun simctl io booted screenshot ./screen.png
to make screenshot of simulatorxcrun simctl openurl booted https://google.com
to open URL in simulatorxcrun 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
Devices
To delete devices go here:
~/Library/Developer/CoreSimulator/Devices
Much easier to delete them use Xcode: Xcode->Window->Devices and Simulators
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
Solution 3 - Ios
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
Solution 4 - Ios
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).
Solution 5 - Ios
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
Solution 6 - Ios
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:
- /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/PhoneSimulator5.0.sdk
- ~/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.
Solution 7 - Ios
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.
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.
Solution 8 - Ios
following some of the answers here, deleting some simulators from my Xcode Menu > Window > Devices > Simulators did nothing to help my dying disk space:
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
Solution 9 - Ios
Update 2021
We can just use the Storage Management tool: CMD + Space 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.
Tested on macOS Big Sur
Solution 10 - Ios
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
Solution 11 - Ios
In XCode open Window - Devices, then select and remove the outdated simulators.
Solution 12 - Ios
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 machinegrep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})"
will grab the device UUIDxargs -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
Solution 13 - Ios
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:
-
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 is13.2.3 (17B111)
, but in future it'll change. The highest number (here13.2.3
) of the iOS version indicates that it's newer. -
After this list your devices in
Terminal
by runningxcrun simctl list devices
. Many of them might beunavailable
, therefore delete them by runningxcrun simctl delete unavailable
. It'll free some space as well. To be sure that everything is fine check it again by runningxcrun simctl list devices
. You should see devices only from the newest version (here13.2.3
) like the screenshot below shows.
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.
Solution 14 - Ios
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.
Solution 15 - Ios
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.
Solution 16 - Ios
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.
Solution 17 - Ios
-
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
-
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
Solution 18 - Ios
On Mac, check /Library/Developer/Xcode/iOS\ DeviceSupport
Solution 19 - Ios
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
Solution 20 - Ios
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.
:)