通过命令行安装iPhone模拟器

查看所有模拟器

xcrun instruments -s

通过以上命令,可以看到系统有以下模拟器:

iPhone 8 (11.2) [39E670F7-F9B0-4A1F-92E7-202EED62E66A] (Simulator)
iPhone 8 (11.2) + Apple Watch Series 3 - 38mm (4.2) [02C9E3B3-9846-4AD0-9890-B2B840811BC9] (Simulator)
iPhone 8 Plus (11.2) [18B8751C-097C-427C-9DB8-BF59FB3C1D7E] (Simulator)
iPhone 8 Plus (11.2) + Apple Watch Series 3 - 42mm (4.2) [E381F8A1-54E9-4428-BE4A-7011902C5D69] (Simulator)
iPhone SE (11.2) [D8ACFB1F-6678-4014-8993-72050939481D] (Simulator)
iPhone X (11.2) [1346D0CB-C0A7-40F9-BB8B-C095B736C696] (Simulator)

打开指定模拟器

xcrun instruments -w "iPhone 8 (11.2)"

安装指定APP

xcrun simctl install booted <app路径>

运行指定的app (com.example.app)

xcrun simctl launch booted <app identifier>

卸载指定的应用

xcrun simctl uninstall booted <app identifier>

Link: 从命令行启动Xcode模拟器