How to "Delete derived data" in Xcode?
Asked Answered
P

11

71

In Xcode5 there is simple option to Delete derived data:

In organiser menu (cmd + shift + 2):

enter image description here

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

Is there any quick methods to delete this trough Xcode6 interface?

Or now I should remove this folders in system manually?

Pour answered 4/6, 2014 at 14:17 Comment(0)
V
46

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

enter image description here

Vevay answered 4/6, 2014 at 17:30 Comment(2)
That's silly. Why not shortcut it to cmd+shift+3 at least? I used that shortcut all the time, mostly for Projects and Archives.Squarrose
This is outdated as of Xcode 6.3. See k k 's answer below.Greene
G
127

Update again: in Xcode 12 go to Preferences -> Locations tab -> click the arrow by the DerivedData path to open it in Finder -> move DerivedData to the trash (Xcode will rebuild it)

Grindstone answered 23/4, 2015 at 17:56 Comment(1)
For XCode 12, the equivalent appears to be Product | Clean Build Folder. Then build and run again. That worked for me. I'd added items to AppIcon in Assets.xcassets after having already built once, and the icon appeared in the dock after Product | Clean Build Folder.Sadesadella
S
59

exit xcode

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

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 space you could brute force the xcode eviction like so

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

Caveat: if you won't exit the xcode first you'd get lingering files (courtesy 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.

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

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.

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

Sanctus answered 20/7, 2015 at 9:2 Comment(1)
Is there a morale issue at Apple? I do this at least once a day so that xcode opens again. XCode 8 has been amazingly bad.Sacker
V
46

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

enter image description here

Vevay answered 4/6, 2014 at 17:30 Comment(2)
That's silly. Why not shortcut it to cmd+shift+3 at least? I used that shortcut all the time, mostly for Projects and Archives.Squarrose
This is outdated as of Xcode 6.3. See k k 's answer below.Greene
W
34

At Xcode 7.2.1 you can now the following:

⌘⌥⇧K

Which is Command + Option + Shift + K

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

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

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

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

$ nuke-dd
Whacking answered 24/3, 2016 at 22:48 Comment(1)
its really helpful.Bellhop
E
9

The approach I'm using is to install the watchdog app (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).

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.

Delete derived data

Eruct answered 1/10, 2015 at 23:31 Comment(0)
E
3

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

Please see the deriveddata-exterminator on GitHub.

===== Update =====

In Xcode8:

Window -> Projects (sometimes Projects disappears,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

just type xcl.

xcode-cache-clean

Emir answered 17/2, 2016 at 6:49 Comment(0)
S
2

Xcode 7.3

Window -> Projects

Then Delete the Derived Data

Shrewish answered 13/6, 2016 at 15:17 Comment(0)
L
1

You can use the command line. My shell script, works for Xcode 4, 5, and 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.

Lunation answered 16/1, 2015 at 6:58 Comment(0)
S
1

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

Section answered 28/6, 2016 at 21:42 Comment(0)
J
1

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

Then I solve it by click on this small icon enter image description here on the right of DerivedData path. It will navigate me to the DerivedData folder.
And in DerivedData, I remove DerivedData by Move To Trash and it removes successfully

Jampan answered 10/10, 2016 at 4:35 Comment(0)
G
0

You can delete derived data by clicking on the going into Xcode > Preferences. See the tutorial I found below.
https://www.youtube.com/watch?v=ueEMGXKDBAc

This image shows a screenshot from the video which will guide you the exact location in Xcode preferences.

Griqua answered 22/5, 2020 at 21:28 Comment(1)
Please add relevant details to your answer and not just post a link. See the accepted answer for guidance and How to answer which suggests: "Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline."Fissure

© 2022 - 2024 — McMap. All rights reserved.