How to Delete Derived Data and Clean Project in Xcode 5 and later?
Another way to delete derived data in Xcode is just by deleting the Derived Data folder. Here is a visual tutorial of how you can do that easily without using command line: https://www.youtube.com/watch?v=ueEMGXKDBAc
It's basically a two-or-three-step process, which cleans the project of all cached assets.
Of course, if anyone uses this technique, and a project still does not show updated assets, then please add an answer! It’s definitely possible that someone out there has encountered situations that require a step that I’m not including.
- Clean your project with Shift-Cmd-K
- Delete derived data by calling a shell script (details below), defined in your bash profile
- Uninstall the App from the Simulator or device.
- For certain types of assets, you may also have to reset the Simulator (under the iOS Simulator menu)
To call the shell script below, simply enter enter the function name (in this case 'ddd') into your terminal, assuming it's in your bash profile. Once you've saved your bash profile, don't forget to update your terminal's environment if you kept it open, with the source command:source ~/.bash_profile
ddd() {
#Save the starting dir
startingDir=$PWD
#Go to the derivedData
cd ~/Library/Developer/Xcode/DerivedData
#Sometimes, 1 file remains, so loop until no files remain
numRemainingFiles=1
while [ $numRemainingFiles -gt 0 ]; do
#Delete the files, recursively
rm -rf *
#Update file count
numRemainingFiles=`ls | wc -l`
done
echo Done
#Go back to starting dir
cd $startingDir
}
I hope that helps, happy coding!