% xcrun simctl list devices
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
검색해보면 Xcode Settings에서 Command Line Tools를 다시 선택하라고 해서 아래의 선택지에서 다시 설정해도 잘 되지 않았다.
아래의 커맨드로 재설정해주면 정상동작되는걸 확인!
% sudo xcode-select --reset
% xcrun simctl list devices
== Devices ==
-- iOS 16.4 --
iPhone SE (3rd generation) (DD499FEC-C0D4-446D-B950-F9FDC0736CDF) (Shutdown)
iPhone 14 (9CBA2BCD-88B4-4CF1-95A6-61E85D94E69F) (Shutdown)
iPhone 14 Plus (3DE4155D-C5F6-4EFC-ACC2-047FBBC7C4AA) (Shutdown)
iPhone 14 Pro (64191C7E-97C1-4949-BF55-EF9DFBAD089E) (Booted)
iPhone 14 Pro Max (D10BDA51-AAE6-4774-A4BC-BC910B2024D1) (Shutdown)
iPad Air (5th generation) (6915CCC6-89C4-4683-B127-E436B1787FDD) (Shutdown)
iPad (10th generation) (D1BD91C7-D6CB-46E2-9F51-F7C0AA5845E1) (Shutdown)
iPad mini (6th generation) (40B63D65-80E0-4099-9269-FC869FC8F8F4) (Shutdown)
iPad Pro (11-inch) (4th generation) (D47700D3-18D9-45AD-BB87-1883293893CF) (Shutdown)
iPad Pro (12.9-inch) (6th generation) (F43DBC07-B979-4FFC-A304-21AA00EC392B) (Shutdown)
위에서 Booted로 bold 처리된 디바이스가 현재 기동되고 있는 simulator의 UUID이다. 해당 디바이스의 디렉토리로 이동하는 방법은?
$ cd /Users/user/Library/Developer/CoreSimulator/Devices/64191C7E-97C1-4949-BF55-EF9DFBAD089E/
$ ls -ail /Users/user1/Library/Developer/CoreSimulator/Devices/64191C7E-97C1-4949-BF55-EF9DFBAD089E/
total 8
1061012 drwxr-xr-x@ 4 user staff 128 Jun 26 18:17 .
1060032 drwxr-xr-x 13 user staff 416 Jun 26 12:08 ..
1061013 drwxrwxr-x 12 user staff 384 Jun 26 18:17 data
2273678 -rw-r--r-- 1 user staff 701 Jun 26 18:17 device.plist
data 디렉토리가 보인다.
$ cd ./data/Containers/Bundle/Application/
$ ls
92949E7D-70B2-4D8B-81C6-98864A4A3264 AE8DF381-EABD-4410-B899-9D2E5C96A1C6
위의 디렉토리가 설치된 App의 UUID임을 알수 있다. App의 UUID 알아내는 법??
% xcrun simctl get_app_container booted package.app.ibzilkgams
/Users/user1/Library/Developer/CoreSimulator/Devices/64191C7E-97C1-4949-BF55-EF9DFBAD089E/data/Containers/Bundle/Application/AE8DF381-EABD-4410-B899-9D2E5C96A1C6/ibzilkgams.app
위의 ‘AE8DF381-EABD-4410-B899-9D2E5C96A1C6’ 디렉토리가 Application의 하위디렉토리의 리스트중 하나와 일치함을 알수 있음.