使用 xcodebuild 下载 SDK

Oct 07, 2024 • 预计阅读时间 1 分钟

Xcode 16.1 beta2 的更新日志有一段说明:

The simulator runtimes are currently available on the Apple Developer website, but will no longer be posted through the website in future updates. Please use xcodebuild -downloadPlatform -exportPath command to download the runtime and then xcodebuild -importPlatform <path/simruntime.dmg> to install it. For more details, see Installing and managing Simulator runtimes. (133776444)

以后不在网站上提供 Simulator Runtime 的下载链接了,需要使用 xcodebuild 来下载:

$ xcodebuild -downloadPlatform iOS -exportPath 'Simulator Runtime'
$ xcodebuild -downloadPlatform tvOS -exportPath 'Simulator Runtime'
$ xcodebuild -downloadPlatform watchOS -exportPath 'Simulator Runtime'
$ xcodebuild -downloadPlatform visionOS -exportPath 'Simulator Runtime'

因为 Simulator Runtime 同时也包含了对应平台的 SDK,所以基本上是需要全部下载回来的。

安装 Simulator Runtime

Xcode 16 开始,使用 xcodebuild

$ xcodebuild -importPlatform "~/Downloads/iOS Simulator Runtime.dmg"

Xcode 16.1 beta 3 开始支持 -buildVersion 指定下载特定系统版本的 Runtime:

$ xcodebuild -downloadPlatform iOS -buildVersion 16.0 -exportPath ./SimRuntimeImages/
$ xcodebuild -downloadPlatform iOS -buildVersion 20A360 -exportPath ./SimRuntimeImages/

如果是 Xcode 15 以及之前的版本,使用 xcrun

$ xcrun simctl runtime add "~/Downloads/iOS Simulator Runtime.dmg"

参考资料

Xcode
版权声明:如果转发请带上本文链接和注明来源。

lvv.me

iOS/macOS Developer

解决阿里云 Debian VPS 启动慢的问题

Debian 设置网卡默认名称为 ethX