在![Mac M1 平台搭建 appium 环境](/2021/11/30/using-appium-in-m1.html) 我们讲解xcode的安装,他默认就会安装模拟器
1. 查看已安装的模拟器(其中Boot状态的为启动状态)
xcrun simctl list
iPhone 8 (29088676-5082-4F66-B5B8-94A5397F32F3) (Booted)
iPhone 11 (B77636AB-B849-4672-8D9D-9DBC0E9DC452) (Shutdown)
29088676-5082-4F66-B5B8-94A5397F32F3 则是他的uuid
2. 开启指定的模拟器(open -a Simulator 打开模拟器页面)
xcrun simctl boot udid
3. 关掉模拟器
xcrun simctl shutdown udid
4. 重置模拟器(清除模拟器的数据和设置)
xcrun simctl erase udid
5. 安装指定app
xcrun simctl install booted <app路径>
6. 运行指定的app
xcrun simctl launch booted <bundle identifier>
多设备下,可以将boot关键字修改为 uuid,这样可以指定安装
xcrun simctl launch uuid <bundle identifier>
7. 关闭已经打开的应用
xcrun simctl terminate booted <bundle identifer>
8. 卸载指定应用
xcrun simctl uninstall booted <bundle identifer>
9. 截图
xcrun simctl io booted screenshot screenshot.png
10. 录屏
xcrun simctl io booted recordVideo example.mp4
11.日志文件的路径:/Users/$UserName/Library/Logs/CoreSimulator/$simulator_hash/system.log
https://www.cnblogs.com/xiyuan2016/p/9929782.html