Xcode - 免费清除设备文件夹? [英] Xcode - free to clear devices folder?

查看:117
本文介绍了Xcode - 免费清除设备文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在删除一些文件夹和文件,以便在我的驱动器上留出更多空间。我知道在路径中:

I am deleting some folders and files to make more space on my drive. I know that in path:

~/Library/Developer/CoreSimulator/Devices/

每个模拟器和每个版本都有文件夹。这个文件夹大小约为11GB。我知道我可以删除我不再使用的旧版本的模拟器。但是从那个唯一的标识符我不知道哪个是正确的,哪个不是。所以我的问题是:我可以删除它吗?没关系,如果下次我在模拟器中没有任何我的应用程序,但我可以放弃更多的东西吗?旧版本的模拟器?还是其他什么?谢谢

There are folders for each simulator and each version. This folder has around 11GB size for me. I know that I could delete simulators with old versions that I no longer use. But from that unique identifier I can't know which is the right one and which not. So my question is: Can I delete it all? It's okay if next time I wouldn't have any of my app in simulator but can I loose something more? Old versions of simulator? Or anything else? Thanks

推荐答案

〜/ Library / Developer / CoreSimulator / Devices / 路径是Xcode存储您的个人模拟器设备所需的大部分数据的地方。

The ~/Library/Developer/CoreSimulator/Devices/ path is where Xcode stores most of the data needed for your individual simulator devices.

Beau Nouvelle关于删除下载的模拟器版本的建议不会改变这些文件夹的大小,因为运行时存储在别处。

Beau Nouvelle's suggestion about deleting downloaded simulator versions would not change the size of these folders, as the runtimes are stored elsewhere.

如果你去终端,你可以使用 simctl 工具(Xcode 6+附带)列出所有您拥有的实际模拟器设备,以及ID,以便您可以找出要删除的文件夹。

If you go to the terminal, you can use the simctl tool (comes with Xcode 6+) to list all of the actual simulator devices you have, along with the ids so that you can figure out what folders to delete.

注意,您会看到我经常使用在这个答案中 xcrun simctl 。通过让xcrun为您当前选择的Xcode查找适当版本的simctl,可以为事物添加一些抽象。如果你的系统没有我的那么复杂,你可以放弃xcrun部分,命令行仍然应该找到simctl工具。

Note, you'll see me constantly use xcrun simctl in this answer. That adds a bit of abstraction to things by having xcrun go look up the appropriate version of simctl for your currently chosen Xcode. If your system is not as complicated as mine, you can probably get by with dropping the "xcrun" part and the commandline should still find the simctl tool.

xcrun simctl list devices

以下是我收到的输出的一些选定片段:

Here are some selected snippets of the output I received:


==设备==

== Devices ==

- iOS 8.2 -

-- iOS 8.2 --

- iOS 8.4 -

-- iOS 8.4 --

iPhone 6 Plus(23E36868-715A-48C8-ACC3-A735C1C83383)(关机)

iPhone 6 Plus (23E36868-715A-48C8-ACC3-A735C1C83383) (Shutdown)

iPad Air(2928379B-70E3-4C59-B5BA-66187DDD3516)(关机)

iPad Air (2928379B-70E3-4C59-B5BA-66187DDD3516) (Shutdown)

- iOS 9.1 -

-- iOS 9.1 --

我的自定义iPhone 4s(4F27F577-FFD0-42C1-8680-86BBA7394271)
(关机)

My Custom iPhone 4s (4F27F577-FFD0-42C1-8680-86BBA7394271) (Shutdown)

iPad Retina(85717B35-313A-4161-850E-D99D5C8194A6)(关机)

iPad Retina (85717B35-313A-4161-850E-D99D5C8194A6) (Shutdown)

- 不可用:com.apple.CoreSimulator.SimRuntime.iOS-9-0 -

-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-9-0 --

iPhone 4s(D24C18BC-268C-4F0B-9CD8-8EFFDE6619E3)(关机)
(不可用,运行时间p rofile not found)

iPhone 4s (D24C18BC-268C-4F0B-9CD8-8EFFDE6619E3) (Shutdown) (unavailable, runtime profile not found)

从中可以看出我没有iOS 8.2模拟器设备。我有一些9.1和8.4模拟器设备。我确实有一个9.0模拟器设备(我在Xcode 7.0上工作的遗留物),但我没有9.0模拟器运行时本身。所以这是一个很好的删除候选者,或提醒我应该在Xcode中下载9.0模拟器。

From that you can see that I have no iOS 8.2 simulator devices. I have some 9.1 and 8.4 simulator devices. I do have a 9.0 simulator device made (a remnant of my work on Xcode 7.0), but I don't have the 9.0 simulator runtime itself. So that's a good candidate for deletion, or a reminder that I should go download the 9.0 simulator in Xcode.

如果需要,可以使用这些ID识别文件夹对于有问题的设备并手动删除它(在这种情况下我会删除D24C18BC-268C-4F0B-9CD8-8EFFDE6619E3文件夹),但你也可以使用simctl工具来做到这一点。

If you want, you can use those ids to identify the folder for the device in question and delete it manually (in this case I would delete the "D24C18BC-268C-4F0B-9CD8-8EFFDE6619E3" folder), but you can also use the simctl tool to do that.

根据7.1.1版本的simctl使用:

Usage according to the 7.1.1 version of simctl:

xcrun simctl help delete
Usage: simctl delete <device> [... <device n>] | unavailable

所以我可以删除单个设备:

So I can either delete the individual device(s):

xcrun simctl delete D24C18BC-268C-4F0B-9CD8-8EFFDE6619E3

或者我可以批量删除所有不可用的:

or I can bulk delete all of the unavailable ones with:

xcrun simctl delete unavailable

也没有必要将自己纯粹限制在不可用的模拟器上。

There is also no need to limit yourself purely to unavailable simulators.

如果你需要任何关于该工具的进一步帮助,它会有一个相当直的转发帮助命令:

If you need any further help with the tool, it comes with a fairly straight forward help command:

xcrun simctl help

这篇关于Xcode - 免费清除设备文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆