xcrun

  • xcrun = Xcode Command-line RUNner
    • 是什么:也是一个命令行工具
      • 是调用其他Xcode命令行工具的入口
        • 底层逻辑:所有XcodeCommand Line都会先被导向xcrun_main,也就是xcrun

用法举例

xcrun simctl list devices

 xcrun simctl list devices
== Devices ==
-- iOS 13.3 --
    iPhone 8 (54589698-0C9F-407D-B21A-83432CABB681) (Shutdown)
    iPhone 8 Plus (509B7103-97DB-4AB9-B829-001190ED4B7E) (Shutdown)
    iPhone 11 (509BC7C7-9C0E-42FA-8AB2-F5220EBAA13B) (Shutdown)
    iPhone 11 Pro (3E8E7E92-66F2-4AF3-A405-23B5FB231DE7) (Shutdown)
    iPhone 11 Pro Max (50C15135-1532-44C5-B82C-B327F88F2712) (Shutdown)
    iPad Pro (9.7-inch) (B11D5D40-FEA2-4114-B053-E4CFD29D127C) (Shutdown)
    iPad (7th generation) (7F8EDE89-74E0-4BAB-B3CA-09E2DAE1F095) (Shutdown)
    iPad Pro (11-inch) (04DD3B8A-5B78-48E8-8B22-56796A9CFB73) (Shutdown)
    iPad Pro (12.9-inch) (3rd generation) (D811684E-2F3E-4FC6-92EA-39301451F7E5) (Shutdown)
    iPad Air (3rd generation) (BBC48526-3922-4C97-BA14-B1888385243A) (Shutdown)
-- tvOS 13.3 --
    Apple TV (6680F059-4DE1-430C-B696-228AC27CAA88) (Shutdown)
    Apple TV 4K (048E58E8-6A27-4D81-BDEB-8812C610B756) (Shutdown)
    Apple TV 4K (at 1080p) (384D5E60-B6B1-481E-BDC3-B7FF8F773412) (Shutdown)
-- watchOS 6.1 --
    Apple Watch Series 4 - 40mm (1B98415B-3FDE-401B-A80C-A3551DB207D7) (Shutdown)
    Apple Watch Series 4 - 44mm (661838E9-B0BE-42B4-B55E-9A34263B1AEA) (Shutdown)
    Apple Watch Series 5 - 40mm (F76D77EF-0932-4164-94BB-9FC757420911) (Shutdown)
    Apple Watch Series 5 - 44mm (D86F0BD5-4D38-4537-9C8C-2F5C74E404CA) (Shutdown)

xcrun simctl list

 xcrun simctl list
== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
iPhone 6s (com.apple.CoreSimulator.SimDeviceType.iPhone-6s)
iPhone 6s Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6s-Plus)
iPhone SE (com.apple.CoreSimulator.SimDeviceType.iPhone-SE)
iPhone 7 (com.apple.CoreSimulator.SimDeviceType.iPhone-7)
iPhone 7 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-7-Plus)
iPhone 8 (com.apple.CoreSimulator.SimDeviceType.iPhone-8)
iPhone 8 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus)
iPhone X (com.apple.CoreSimulator.SimDeviceType.iPhone-X)
iPhone Xs (com.apple.CoreSimulator.SimDeviceType.iPhone-XS)
iPhone Xs Max (com.apple.CoreSimulator.SimDeviceType.iPhone-XS-Max)
iPhone Xʀ (com.apple.CoreSimulator.SimDeviceType.iPhone-XR)
iPhone 11 (com.apple.CoreSimulator.SimDeviceType.iPhone-11)
iPhone 11 Pro (com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro)
iPhone 11 Pro Max (com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro-Max)
iPad 2 (com.apple.CoreSimulator.SimDeviceType.iPad-2)
iPad Retina (com.apple.CoreSimulator.SimDeviceType.iPad-Retina)
iPad Air (com.apple.CoreSimulator.SimDeviceType.iPad-Air)
iPad mini 2 (com.apple.CoreSimulator.SimDeviceType.iPad-mini-2)
iPad mini 3 (com.apple.CoreSimulator.SimDeviceType.iPad-mini-3)
iPad mini 4 (com.apple.CoreSimulator.SimDeviceType.iPad-mini-4)
iPad Air 2 (com.apple.CoreSimulator.SimDeviceType.iPad-Air-2)
iPad Pro (9.7-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--9-7-inch-)
iPad Pro (12.9-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro)
iPad (5th generation) (com.apple.CoreSimulator.SimDeviceType.iPad--5th-generation-)
iPad Pro (12.9-inch) (2nd generation) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---2nd-generation-)
iPad Pro (10.5-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--10-5-inch-)
iPad (6th generation) (com.apple.CoreSimulator.SimDeviceType.iPad--6th-generation-)
iPad (7th generation) (com.apple.CoreSimulator.SimDeviceType.iPad--7th-generation-)
iPad Pro (11-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--11-inch-)
iPad Pro (12.9-inch) (3rd generation) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---3rd-generation-)
iPad mini (5th generation) (com.apple.CoreSimulator.SimDeviceType.iPad-mini--5th-generation-)
iPad Air (3rd generation) (com.apple.CoreSimulator.SimDeviceType.iPad-Air--3rd-generation-)
Apple TV (com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p)
Apple TV 4K (com.apple.CoreSimulator.SimDeviceType.Apple-TV-4K-4K)
Apple TV 4K (at 1080p) (com.apple.CoreSimulator.SimDeviceType.Apple-TV-4K-1080p)
Apple Watch - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-38mm)
Apple Watch - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-42mm)
Apple Watch Series 2 - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-2-38mm)
Apple Watch Series 2 - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-2-42mm)
Apple Watch Series 3 - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-3-38mm)
Apple Watch Series 3 - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-3-42mm)
Apple Watch Series 4 - 40mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-4-40mm)
Apple Watch Series 4 - 44mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-4-44mm)
Apple Watch Series 5 - 40mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-5-40mm)
Apple Watch Series 5 - 44mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-5-44mm)
== Runtimes ==
iOS 13.3 (13.3 - 17C45) - com.apple.CoreSimulator.SimRuntime.iOS-13-3
tvOS 13.3 (13.3 - 17K446) - com.apple.CoreSimulator.SimRuntime.tvOS-13-3
watchOS 6.1 (6.1.1 - 17S445) - com.apple.CoreSimulator.SimRuntime.watchOS-6-1
== Devices ==
-- iOS 13.3 --
    iPhone 8 (54589698-0C9F-407D-B21A-83432CABB681) (Shutdown)
    iPhone 8 Plus (509B7103-97DB-4AB9-B829-001190ED4B7E) (Shutdown)
    iPhone 11 (509BC7C7-9C0E-42FA-8AB2-F5220EBAA13B) (Shutdown)
    iPhone 11 Pro (3E8E7E92-66F2-4AF3-A405-23B5FB231DE7) (Shutdown)
    iPhone 11 Pro Max (50C15135-1532-44C5-B82C-B327F88F2712) (Shutdown)
    iPad Pro (9.7-inch) (B11D5D40-FEA2-4114-B053-E4CFD29D127C) (Shutdown)
    iPad (7th generation) (7F8EDE89-74E0-4BAB-B3CA-09E2DAE1F095) (Shutdown)
    iPad Pro (11-inch) (04DD3B8A-5B78-48E8-8B22-56796A9CFB73) (Shutdown)
    iPad Pro (12.9-inch) (3rd generation) (D811684E-2F3E-4FC6-92EA-39301451F7E5) (Shutdown)
    iPad Air (3rd generation) (BBC48526-3922-4C97-BA14-B1888385243A) (Shutdown)
-- tvOS 13.3 --
    Apple TV (6680F059-4DE1-430C-B696-228AC27CAA88) (Shutdown)
    Apple TV 4K (048E58E8-6A27-4D81-BDEB-8812C610B756) (Shutdown)
    Apple TV 4K (at 1080p) (384D5E60-B6B1-481E-BDC3-B7FF8F773412) (Shutdown)
-- watchOS 6.1 --
    Apple Watch Series 4 - 40mm (1B98415B-3FDE-401B-A80C-A3551DB207D7) (Shutdown)
    Apple Watch Series 4 - 44mm (661838E9-B0BE-42B4-B55E-9A34263B1AEA) (Shutdown)
    Apple Watch Series 5 - 40mm (F76D77EF-0932-4164-94BB-9FC757420911) (Shutdown)
    Apple Watch Series 5 - 44mm (D86F0BD5-4D38-4537-9C8C-2F5C74E404CA) (Shutdown)
== Device Pairs ==
56795D8F-84E0-4F5A-BA60-517EF25593FF (active, disconnected)
    Watch: Apple Watch Series 5 - 40mm (F76D77EF-0932-4164-94BB-9FC757420911) (Shutdown)
    Phone: iPhone 11 Pro (3E8E7E92-66F2-4AF3-A405-23B5FB231DE7) (Shutdown)
4DDF7790-928A-4D86-B2BC-213F785F5188 (active, disconnected)
    Watch: Apple Watch Series 5 - 44mm (D86F0BD5-4D38-4537-9C8C-2F5C74E404CA) (Shutdown)
    Phone: iPhone 11 Pro Max (50C15135-1532-44C5-B82C-B327F88F2712) (Shutdown)

help语法

 crifan@licrifandeMacBook-Pro  ~  xcrun --help
Usage: xcrun [options] <tool name> ... arguments ...

Find and execute the named command line tool from the active developer
directory.

The active developer directory can be set using `xcode-select`, or via the
DEVELOPER_DIR environment variable. See the xcrun and xcode-select manual
pages for more information.

Options:
  -h, --help                  show this help message and exit
  --version                   show the xcrun version
  -v, --verbose               show verbose logging output
  --sdk <sdk name>            find the tool for the given SDK name
  --toolchain <name>          find the tool for the given toolchain
  -l, --log                   show commands to be executed (with --run)
  -f, --find                  only find and print the tool path
  -r, --run                   find and execute the tool (the default behavior)
  -n, --no-cache              do not use the lookup cache
  -k, --kill-cache            invalidate all existing cache entries
  --show-sdk-path             show selected SDK install path
  --show-sdk-version          show selected SDK version
  --show-sdk-build-version    show selected SDK build version
  --show-sdk-platform-path    show selected SDK platform path
  --show-sdk-platform-version show selected SDK platform version

results matching ""

    No results matching ""