How to “Delete derived data” in Xcode?
-
21-12-2019 - |
Question
In Xcode5 there is simple option to Delete derived data:
In organiser menu (cmd + shift + 2):
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?
Solution
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.
OTHER TIPS
Update: in Xcode 6.3 (and 7) there is a separate Projects window. Use the Window dropdown menu to find it.
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.
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
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.
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 7.3
Window -> Projects
Then Delete the Derived Data
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.
rm -rf ~/Library/Developer/Xcode/DerivedData Then in terminal, type purgeallbuilds, and all subfolders of DerivedData are deleted.
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 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