Digging into disk usage, I found old unused iOS simulators still sitting around.
I couldn't find much information online when I looked for how to clean them up, so here's the method.
Assess the Situation
First, check disk usage:MacBook-Air:~ $ du -sh ~/Library/Developer/*
4.5G Library/Developer/CoreSimulator
4.2M Library/Developer/Shared
30G Library/Developer/Xcode
Simulators are stored under CoreSimulator — 4.5GB.Even if you think you only have the latest iOS simulator installed, you end up with about 100 entries like this:
MacBook-Air:~ $ ls ~Library/Developer/CoreSimulator/Devices/
02920FBA-70BB-4151-A812-2781B21C9310 85294178-C816-445D-B721-0F5B66EB6C1C
0C6A0874-5BA9-4C67-BB20-F57BF0BCAD3B 857ED83C-660E-4DA0-9B47-93604E175793
0F9F2A17-034E-416E-A871-1FBE54F6C6ED 85B3622F-4C8B-4ADA-8F82-4C9CF4759E39
11E82193-8207-4AF1-A6B4-286113C0490C 85D35A3C-6682-48DD-B35E-C5870E8975A9
16469CC0-4DD0-42C8-A782-CEFE4C505756 8A8FDA9A-F064-420A-8684-7666559F4D61
:
Identifying Unnecessary Simulators
Checking these one by one to decide which to delete? Absolutely not.Fortunately, Apple provides a command for this.
"xcrun simctl list" shows the status of all simulators:
MacBook-Air:~ $ xcrun simctl list
== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
:
== Runtimes ==
iOS 10.3 (10.3 - 14E269) (com.apple.CoreSimulator.SimRuntime.iOS-10-3)
tvOS 10.2 (10.2 - 14W260) (com.apple.CoreSimulator.SimRuntime.tvOS-10-2)
watchOS 3.2 (3.2 - 14V243) (com.apple.CoreSimulator.SimRuntime.watchOS-3-2)
== Devices ==
-- iOS 10.3 --
iPhone 5 (1AD05780-679D-4819-B841-97DDF6F572F6) (Shutdown)
iPhone 5s (3D7CBDDC-6D4D-4154-A815-A85CE2953F25) (Shutdown)
iPhone 6 (822F3C1D-C566-42A5-A888-8864FEA1C5D0) (Shutdown)
:
-- tvOS 10.2 --
Apple TV 1080p (2E35F89E-2C32-4689-83D9-D2ADCEBE34F3) (Shutdown)
-- watchOS 3.2 --
Apple Watch - 38mm (0C6A0874-5BA9-4C67-BB20-F57BF0BCAD3B) (Shutdown)
Apple Watch - 42mm (BDB19BBE-8386-4DF2-B103-E1A5B969D4D3) (Shutdown)
Apple Watch Series 2 - 38mm (B58B5DB4-9F9F-4FF0-A830-AEF9C2AF057B) (Shutdown)
Apple Watch Series 2 - 42mm (6ACBB806-43DE-47F7-838F-EF1BA64DCB1C) (Shutdown)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-10-0 --
iPhone 5 (435DED31-5DCA-4FBF-8CC5-3BA5E6FFD1D0) (Shutdown) (unavailable, runtime profile not found)
iPhone 5s (76FDA547-B754-4100-B51C-0731EB62F7CB) (Shutdown) (unavailable, runtime profile not found)
iPhone 6 (C28739B4-4A8B-40BB-A311-CB1DDCBD60E2) (Shutdown) (unavailable, runtime profile not found)
:
-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-10-1 --
iPhone 5 (E72D4C90-3589-40F9-9A8E-A63DD3239BFA) (Shutdown) (unavailable, runtime profile not found)
iPhone 5s (1AE73560-DDB7-4BDA-BC32-B36A0000EF57) (Shutdown) (unavailable, runtime profile not found)
:
The key here is the "Unavailable" entries.
In my case, I only intended to have the latest iOS (10.3 at the time) simulators installed,
but iOS 10.0 and 10.1 simulators were sitting there marked "Unavailable".
These appear to be device images left over after I had installed and then deleted older iOS runtimes — the runtime was gone, but the device images remained.
Deleting Unnecessary Device Images
Now that I know what's taking up space, I don't want to delete them one by one.Again, Apple has a command for this:
MacBook-Air:~ $ xcrun simctl delete unavailable
That's it. Done.The folder that was using 4.5GB shrank to 140MB.
MacBook-Air:Devices isao$ du -sh ~/Library/Developer/*
140M /Users/{username}/Library/Developer/CoreSimulator
4.2M /Users/{username}/Library/Developer/Shared
2.9G /Users/{username}/Library/Developer/Xcode
No comments:
Post a Comment