Xcode Simulator:如何删除旧的不需要的设备?

Dav*_*d H 200 xcode ios ios-simulator

我正在运行Xcode 4.3.1 iOS-Simulator,它最初只支持iOS 5.1.

我需要使用iOS 4.3测试我的代码,所以我使用Xcode的"安装"功能来安装它,如"使用iOS 4.3设备模拟器安装Xcode?"中所述.

现在我已完成测试但无法找到卸载4.3部分的方法("iPhone 4.3模拟器"和"iPad 4.3模拟器").我想减少Scheme菜单中的混乱.

Apple的Xcode listserv上没有人知道答案!

编辑:请注意,自Xcode 4.3以来已经发生了很多变化,所以建议所有人阅读这些内容来了解​​所有答案.史蒂夫·莫泽(Steve Moser)这样的最新产品对您来说可能更有用!

编辑10/2017:由Julio Carrettoni在Twitter上发布

如果您是iOS开发人员,请执行以下操作:
$ xcrun simctl delete unavailable
删除Xcode不再使用的旧模拟器.对我来说这是6Gb我自己没试过......

[另外,我刚才看到Russ Bishop在下面的评论中提到了这个...]

tom*_*44g 199

在Xcode 6+中,您只需转到菜单>窗口>设备>模拟器,然后删除不需要的模拟器.

  • 那是正确的.如果你想让模拟器"真的消失"或者在Xcode - > Preferences - > Downloads中重新安装它们,你必须删除模拟器运行时,如下所示http://stackoverflow.com/a/30206853/1344293 (3认同)

chi*_*.de 168

您是否尝试过从Xcode包中删除4.3 SDK?

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs

请同时删除相应的.dmg文件

〜/图书馆/缓存/ com.apple.dt.Xcode /下载

防止从Xcode中重新安装一次相同的包.


对于XCode> = 6,请参阅@ praveen-matanam的回答

  • 你是个天才!非常感谢!不敢相信没有Xcode listserv知道这一点.我看了几个地方,但没有你建议的地方. (3认同)
  • 为Xcode 6.3.1工作,以及这个答案http://stackoverflow.com/a/30206853/286618.清除旧文档并保存9GB! (2认同)

Pra*_*nam 149

在Xcode 6及更高版本中,您可以从路径中查找和删除模拟器/Library/Developer/CoreSimulator/Profiles/Runtimes.重启Xcode以使其生效(可能不需要).

  • 7.2 - 无需重启 (2认同)
  • @thiagoveloso这是因为你没有安装任何其他版本的模拟器,而是iOS 10.0+.我只有9.3,8.4和8.3`simruntime`文件 (2认同)

Pav*_*lev 109

2018年10月更新

如前所述,您可以使用以下xcrun内容:

  • xcrun simctl list devicesxcrun simctl list --json列出所有模拟器
  • xcrun simctl delete <device udid> 删除特定设备
  • xcrun simctl delete unavailable 删除不再支持的运行时的旧设备

你可以做更多的事情xcrun(参见代码片段)

- `xcrun simctl boot <device udid>` to launch (multiple) simulators
- `xcrun simctl io booted recordVideo — type=mp4 ./test.mp4` to record simulator video
- `xcrun simctl io booted screenshot ./screen.png` to make screenshot of simulator
- `xcrun simctl openurl booted https://google.com` to open URL in simulator
- `xcrun simctl addmedia booted ./test.mp4` to upload photo or video file (for photos app)
- `xcrun simctl get_app_container booted <your apps bundle identifier>` to find the app container (where identifier is like *com.bundle.identifier*)
- `xcrun simctl help` to explore **more** commands
Run Code Online (Sandbox Code Playgroud)

原始答案

2017年9月,Xcode 9

运行时

你会在这里找到它们:

/Library/Developer/CoreSimulator/Profiles/Runtimes
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

设备

要删除设备,请点击此处:

~/Library/Developer/CoreSimulator/Devices
Run Code Online (Sandbox Code Playgroud)

更容易删除它们使用Xcode:Xcode-> Window-> Devices and Simulators 在此输入图像描述

帮助Xcode"忘记"运行时并防止重新安装它们 - 删除.dmg文件:

~/Library/Caches/com.apple.dt.Xcode/Downloads
Run Code Online (Sandbox Code Playgroud)

我希望它能帮助别人

  • 请不要删除文件系统中的设备; 使用`xcrun simctl delete <device udid>`.您还可以运行`xcrun simctl delete unavailable`来删除不再支持的运行时的旧设备. (7认同)
  • 非常适合我,谢谢 (3认同)

Ste*_*ser 73

在终端中运行此命令以删除无法从您机器上使用的当前版本的Xcode(8+?)访问的模拟器.

xcrun simctl delete unavailable

此外,如果你想要收回模拟器相关空间,Michael Tsai发现删除sim日志可以节省30 GB.

~/Library/Logs/CoreSimulator
Run Code Online (Sandbox Code Playgroud)

  • 谢谢!显然最初的问题是Xcode 4,所以事情发生了很大的变化! (2认同)
  • 它为我释放了近20GB.谢谢 (2认同)

Dan*_*ese 26

如果您删除SDK,Xcode 4.6将提示您重新安装任何旧版本的iOS模拟器.为避免这种情况,您还必须删除Xcode缓存.然后,您不会被迫在启动时重新安装旧的SDK.

要删除iOS 5.0模拟器,请删除它们,然后重新启动Xcode:

  1. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/PhoneSimulator5.0.sdk
  2. 〜/图书馆/缓存/ com.apple.dt.Xcode

例如,在彻底安装Xcode之后,我从Xcode首选项安装了iOS 5.0模拟器.后来,我认为5.1已经足够但无法删除5.0版本.Xcode一直强迫我在发布时重新安装它.删除缓存文件和SDK后,它不再询问.

  • 确认; 这适用于Xcode 4.6.谢谢! (2认同)

egg*_*ats 23

2024 年:macOS 索诺玛和文图拉

\n

与之前版本相同,在您的聚光灯搜索工具中搜索存储,然后双击“开发人员”选项。

\n

现在界面看起来有点不同

\n

在此输入图像描述

\n

2023 年之前的 macOS 大苏尔和蒙特利

\n

我们可以使用存储管理工具:\n \xe2\x8c\x98 + 空格键并搜索存储。

\n

在开发人员下:您可以找到 Xcode 缓存和构建文件,以及可以删除的旧版本 iOS 支持文件。

\n

在此输入图像描述

\n

在 macOS Big Sur 和 Monterey 上测试

\n


rus*_*net 17

我有同样的问题.我的空间不多了.删除旧设备模拟器没有帮助.

根本原因是xCode保留了每个iOS版本,因为我安装了xCode.

删除你不想要的iOS版本并释放磁盘空间.我节省了50GB +的空间.

在此输入图像描述 如果您在一台计算机上有多个macOS用户,请确保使用最初安装xCode的用户帐户查找此目录.


abb*_*ood 7

遵循此处的一些答案,从我的xcode菜单>窗口>设备>模拟器中删除一些模拟器并没有帮助我垂死的磁盘空间: 在此处输入图片说明

但是通过/Users/abdullah/Library/Developer/Xcode/iOS DeviceSupport跑步,du -sh *我得到了所有这些家伙:

2.9G    10.0.1 (14A403)
1.3G    10.1.1 (14B100)
2.9G    10.3.2 (14F89)
1.3G    10.3.3 (14G60)
1.9G    11.0.1 (15A402)
1.9G    11.0.3 (15A432)
2.0G    11.1.2 (15B202)
2.0G    11.2 (15C114)
2.0G    11.2.1 (15C153)
2.0G    11.2.2 (15C202)
2.0G    11.2.6 (15D100)
2.0G    11.4 (15F79)
2.0G    11.4.1 (15G77)
2.3G    12.0 (16A366)
2.3G    12.0.1 (16A404)
2.3G    12.1 (16B92)
Run Code Online (Sandbox Code Playgroud)

总共33 GB!

洗完澡

在这里查看更多详细信息


Ray*_*ond 6

除了@ childno.de,还有你的Mac目录

/private/var/db/receipts/

可能仍然包含过时的iPhoneSimulatorSDK .bom和这样的.plist文件:

/private/var/db/receipts/com.apple.pkg.iPhoneSimulatorSDK8_4.bom /private/var/db/receipts/com.apple.pkg.iPhoneSimulatorSDK8_4.plist

这些可能会使Xcode首选项的"下载"选项卡显示?该过时模拟器版本的tick().

要清除不需要的模拟器,您可以使用Mac终端上的此bash命令进行搜索:

sudo find / -name "*PhoneSimulator*"

然后转到相应的目录以手动删除不需要的SimulatorSDK


cat*_*ore 6

在 XCode 中打开“窗口 - 设备”,然后选择并删除过时的模拟器。


Mic*_*cky 6

更新 Xcode 14

在 Xcode 14 中,您最终可以通过设置中的“平台”部分卸载模拟器运行时。只需选择一个并点击左下角的减号“-”按钮即可。