如何在 Xcode 中“删除派生数据”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24039932/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:06:53  来源:igfitidea点击:

How to "Delete derived data" in Xcode?

xcodexcode6ios-simulator

提问by skywinder

In Xcode5there is simple option to Delete derived data:

Xcode5 中有一个简单的选项来删除派生数据:

In organiser menu (cmd+ shift+ 2):

在组织者菜单 ( cmd+ shift+ 2) 中:

enter image description here

在此处输入图片说明

But with new interface of Xcode6 there is no similar options.

但是在 Xcode6 的新界面中没有类似的选项。

Is there any quick methods to delete this trough Xcode6interface?

是否有任何快速方法可以通过Xcode6接口删除此槽?

Or now I should remove this folders in system manually?

或者现在我应该手动删除系统中的这个文件夹?

采纳答案by vladof81

Pressing Cmd+ Shift+ 2In Xcode 6 will present Devices, which is separated from Organizer. Instead you can go Window, then Organizer, then find your project in Projectsto delete derived data. You may set a short key in Key Bindings for quick access to derived data.

按压Cmd+ Shift+2在Xcode中6将本发明的装置,其由分离的组织者。相反,您可以转到Window,然后是Organizer,然后在Projects 中找到您的项目以删除派生数据。您可以在 Key Bindings 中设置一个快捷键,以便快速访问派生数据。

enter image description here

在此处输入图片说明

回答by k k

Update: in Xcode 6.3 (and 7) there is a separate Projects window. Use the Window dropdown menu to find it.

更新:在 Xcode 6.3(和 7)中有一个单独的项目窗口。使用窗口下拉菜单找到它。

回答by Anton Tropashko

exit xcode

退出 xcode

In the Terminal application (I'm sure you have it open at all times ;^) type:

在终端应用程序中(我确定你一直打开它;^)输入:

rm -rf ~/Library/Developer/Xcode/DerivedData

rm -rf ~/Library/Developer/Xcode/DerivedData

If xcode does not cooperate when you asked it politely to exit from file menu or via Command-Q shortcut due to some incessant popup craving for your attention in a pile of windows in a long forgotten spaceyou could brute force the xcode eviction like so

如果 xcode 在您礼貌地要求它退出文件菜单或通过 Command-Q 快捷方式退出时不合作,因为在一个长期被遗忘的空间中的一堆窗口中不断出现渴望您的注意力的弹出窗口,您可以像这样暴力强制驱逐 xcode

killall Xcode; rm -rf ~/Library/Developer/Xcode/DerivedData

杀死所有的Xcode;rm -rf ~/Library/Developer/Xcode/DerivedData

Caveat: if you won't exit the xcode first you'd get lingering files (cutesy of HFS I suppose) and you'd have to use the Sheamus'es script. Feel free to share your experience with the newer (no longer experimental) macos fs in the comments below.

警告:如果你不先退出 xcode,你会得到挥之不去的文件(我想是 HFS 的可爱之处),你必须使用 Sheamus'es 脚本。请随时在下面的评论中与较新的(不再是实验性的)macos fs 分享您的经验。

bash tip of the day: tab performs filename completion as you type paths

bash 每日提示:选项卡在您键入路径时执行文件名补全

Tip of the year: consider procuring O'Reilly bash book[s] to save your time further. Disclaimer: I do not work for O'Reilly, never did. Just a happy customer.

年度提示:考虑购买 O'Reilly bash book[s] 以进一步节省您的时间。免责声明:我不为 O'Reilly 工作,从来没有。只是一个快乐的客户。

Though in my recent experience with Xcode 10.2.1 Windows(Cmd)+Shift+k shortcut works just fine.

虽然在我最近使用 Xcode 10.2.1 Windows(Cmd)+Shift+k 快捷方式的经验中工作得很好。

回答by Aaron

At Xcode 7.2.1 you can now the following:

在 Xcode 7.2.1 中,您现在可以执行以下操作:

???K

???K

Which is Command+ Option+ Shift+ K

哪个是Command+ Option+ Shift+K

Alternatively you can select Product > (Hold ?Key) and select Clean Build Folder...

或者,您可以选择 Product > (Hold ?Key) 并选择 Clean Build Folder...

Edit:I also like to create an alias for one of @anton-tropashko's suggested shell commands:

编辑:我也喜欢为 @anton-tropashko 建议的 shell 命令之一创建别名:

alias nuke-dd='rm -rv ~/Library/Developer/Xcode/DerivedData'

Add this ^^ to your ~/.bash_profileor somewhere else that is sourced for each shell you start, then just type:

将此 ^^ 添加到您~/.bash_profile或您启动的每个 shell 的其他地方,然后只需键入:

$ nuke-dd

回答by Reefwing

The approach I'm using is to install the watchdog app (https://www.cerebralgardens.com/watchdog).

我使用的方法是安装看门狗应用程序 ( https://www.cerebralgardens.com/watchdog)

This app will automatically clear your derived data based on your preferences (e.g. when data exceeds a certain size, when xcode closes, daily at a certain time, manually or when a clean is detected).

此应用程序将根据您的偏好自动清除您的派生数据(例如,当数据超过特定大小时、xcode 关闭时、每天特定时间、手动或检测到清洁时)。

EDIT:

编辑:

For those who don't want to spend money, in Xcode 7 select the Windows menu and Project. You can then select your project and delete its derived data (see screenshot below). Note that if there is a blue dot next to your project it indicates that it is open. It is better to close your project before deleting the derived data.

对于那些不想花钱的人,在 Xcode 7 中选择 Windows 菜单和项目。然后,您可以选择您的项目并删除其派生数据(请参见下面的屏幕截图)。请注意,如果您的项目旁边有一个蓝点,则表示它已打开。最好在删除派生数据之前关闭您的项目。

Delete derived data

删除派生数据

回答by hstdt

I suggest to install the plugin DerivedData Exterminatorby Alcatraz to clean up in Xcode6/7.

我建议安装Alcatraz的插件DerivedData Exterminator以在 Xcode6/7 中进行清理。

Please see the deriveddata-exterminator on GitHub.

请参阅GitHub 上衍生数据灭虫器

===== Update =====

===== 更新 =====

In Xcode8:

在 Xcode8 中:

Window -> Projects (sometimes Projectsdisappears,try it again, maybe a bug) Choose your project,then click the delete button.

窗口 -> 项目(有时项目消失,再试一次,可能是一个错误)选择你的项目,然后点击删除按钮。

Or using Alfred:

或者使用阿尔弗雷德:

http://www.packal.org/workflow/xcode-cache-clean

http://www.packal.org/workflow/xcode-cache-clean

just type xcl.

只需键入 xcl。

xcode-cache-clean

xcode-cache-clean

回答by kavehmb

Xcode 7.3

Xcode 7.3

Window -> Projects

Then Delete the Derived Data

然后删除派生数据

回答by Aks

rm -rf ~/Library/Developer/Xcode/DerivedData Then in terminal, type purgeallbuilds, and all subfolders of DerivedData are deleted.

rm -rf ~/Library/Developer/Xcode/DerivedData 然后在终端输入purgeallbuilds,DerivedData的所有子文件夹都被删除了。

回答by Phan Van Linh

Sometimes I have hit on Deletebutton on DerivedData in (Window -> Projects) but it doesn't work.

有时我Delete在(Window -> Projects)中点击了 DerivedData上的按钮,但它不起作用。

Then I solve it by click on this small iconenter image description hereon the right of DerivedDatapath. It will navigate me to the DerivedDatafolder.
And in DerivedData, I remove DerivedDataby Move To Trash and it removes successfully

然后我通过单击路径右侧的这个小图标在此处输入图片说明来解决它DerivedData。它会将我导航到该DerivedData文件夹。
在 中DerivedData,我DerivedData通过 Move To Trash 删除并成功删除

回答by Sheamus

You can use the command line. My shell script, works for Xcode 4, 5, and 6.

您可以使用命令行。我的shell 脚本适用于 Xcode 4、5 和 6。

Sometimes, simply calling rm -rf on the Derived Data directory leaves a lingering file or two, but my script loops until all files are deleted.

有时,只需在派生数据目录上调用 rm -rf 会留下一两个文件,但我的脚本会循环播放,直到所有文件都被删除。