한 머신에서 오랫동안 OS 포멧 없이 개발을 진행하다 보면 디스크 용량이 부족해진다.
특히 요즘처럼 Xcode가 시도 때도 없이 업데이트되고, 돌아서면 새로운 iOS 버전이 릴리스되면 은근히 디스크의 압박이 심해진다.
나의 경우에는 회사 아이맥의 디스크 용량이 256GB인데, iOS/iPad/tvOS 시뮬레이터를 운영하다 보니 디스크 용량이 부족해 IDE 업데이트가 안 되는 현상이 발생했다 ㅠㅠ
찾아보니 이런 경우에 현재의 Xcode에서 지원하지 않는(사용할 수 없는) 시뮬레이터를 한방에 제거해주는 커멘드가 있었다.
명령어는 다음과 같다.
xcrun simctl delete unavailable
Xcode가 시뮬레이터를 저장하는 폴더는 아래와 같다.
~/Library/Developer/CoreSimulator/Devices/
여기에 저장되어 있는 디바이스 리스트는 UDID 형태로 이름이 지정되어 있어 메타 정보를 한눈에 알아보기가 어려운데, 이 때는 다음의 커멘드를 사용한다.
xcrun simctl list devices // Output Example == Devices == -- iOS 13.4 -- iPhone 8 (A9C3FF9E-F49F-46F0-AA86-5E1A8505D5CA) (Shutdown) iPhone 8 Plus (DA60DEFF-6636-4B82-A675-4B54A0A66E86) (Shutdown) iPhone 11 (70A32B44-E543-4E5E-9D2B-CAA8AC826F05) (Shutdown) iPhone 11 Pro (60FE0990-AFAA-4372-AE7E-2C6DDE06A68D) (Shutdown) iPhone 11 Pro Max (44D12758-0B49-453E-A39F-82153BAC93ED) (Shutdown) iPhone SE (2nd generation) (39573D2D-7058-4500-A3B2-8CE02D01DAC1) (Shutdown) iPad Pro (9.7-inch) (C89B4DAE-501D-48FA-ADCB-DB4E0EACA523) (Shutdown) iPad (7th generation) (CE791526-7425-4BBA-8200-7D4D103DAABC) (Shutdown) iPad Pro (11-inch) (2nd generation) (929A8537-D01E-44F4-B492-1AE64ECFD4D4) (Shutdown) iPad Pro (12.9-inch) (4th generation) (592EB490-671F-4EE5-870E-98DD97AE48D8) (Shutdown) iPad Air (3rd generation) (815F0ED5-6BB9-4327-A560-38973E63209B) (Shutdown) -- tvOS 13.4 -- Apple TV (977AA02B-3B43-408B-A6CA-B7B265DDE488) (Shutdown) Apple TV 4K (EEF46122-0F39-4DDB-86E9-DF7746F591C1) (Shutdown) Apple TV 4K (at 1080p) (C90FD1EF-38C4-48C4-AC13-221A66E6B3B8) (Shutdown) -- watchOS 6.2 -- Apple Watch Series 4 - 40mm (9282C5A0-F714-41F6-9BCA-7D085FBE301F) (Shutdown) Apple Watch Series 4 - 44mm (660D4291-5F26-4365-9949-91D80DBE6567) (Shutdown) Apple Watch Series 5 - 40mm (95157B4A-3B33-456F-AE63-7335872CD475) (Shutdown) Apple Watch Series 5 - 44mm (23A5B8FF-B91A-465A-A1C4-C11C6F393F19) (Shutdown) -- unavailable {something} ...
처음에 소개한 명령어는 위 리스트에서 unavailable 로 표시된 리스트를 한번에 제거해주는 명령어로 이해하면 된다.
unavailable 로 마킹되는 기준은 아마도 xcode-select 의 현재 버전에서 지원하지 않는 기기의 목록인것 같다.
이 외에도 현재 사용할 수 있는 특정 활성 기기를 제거하는 명령어는 다음과 같다.
xcrun simctl delete {deviceUDID}
simctl 에 대한 더 많은 명령어를 보려면,
xcrun simctl help usage: simctl [--set <path>] [--profiles <path>] <subcommand> ... simctl help [subcommand] Command line utility to control the Simulator For subcommands that require a <device> argument, you may specify a device UDID or the special "booted" string which will cause simctl to pick a booted device. If multiple devices are booted when the "booted" device is selected, simctl will choose one of them. Subcommands: create Create a new device. clone Clone an existing device. upgrade Upgrade a device to a newer runtime. delete Delete spcified devices, unavailable devices, or all devices. pair Create a new watch and phone pair. unpair Unpair a watch and phone pair. pair_activate Set a given pair as active. erase Erase a device's contents and settings. boot Boot a device. shutdown Shutdown a device. rename Rename a device. getenv Print an environment variable from a running device. openurl Open a URL in a device. addmedia Add photos, live photos, videos, or contacts to the library of a device. install Install an app on a device. uninstall Uninstall an app from a device. get_app_container Print the path of the installed app's container launch Launch an application by identifier on a device. terminate Terminate an application by identifier on a device. spawn Spawn a process by executing a given executable on a device. list List available devices, device types, runtimes, or device pairs. icloud_sync Trigger iCloud sync on a device. pbsync Sync the pasteboard content from one pasteboard to another. pbcopy Copy standard input onto the device pasteboard. pbpaste Print the contents of the device's pasteboard to standard output. help Prints the usage for a given subcommand. io Set up a device IO operation. diagnose Collect diagnostic information and logs. logverbose enable or disable verbose logging for a device status_bar Set or clear status bar overrides ui Get or Set UI options push Send a simulated push notification privacy Grant, revoke, or reset privacy and permissions keychain Manipulate a device's keychain
를 입력하면 된다.
찾아보니 이 명령어를 통해 수십 GB의 용량을 확보했다는(…) 사람도 있는데, 잘 사용하면 디스크를 효율적으로 관리할 수 있을 것 같다.