69
votes

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?

11

11 Answers

121
votes

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)

58
votes

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 (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.

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.

46
votes

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

34
votes

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
9
votes

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

3
votes

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

2
votes

Xcode 7.3

Window -> Projects

Then Delete the Derived Data

1
votes

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.

1
votes

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

1
votes

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

0
votes

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.