Reputation: 27618
I am running low on disk space and checked through a third party utility that among other things that ~/Library/Developer/Xcode/DerivedData directory is taking about 22GB of disk space.
I searched stackoverflow and found this post
How can I safely delete in my ~/Library/Developer/Xcode/DerivedData directory?
The accepted answer to this question suggests that I should not touch / remove folders from this directory. so what I did was
Unless I missed something in that posts answer I want to make sure by asking experienced developers that if I delete all the folders from DerivedData it will not hurt me in building, testing and compiling those projects.
Upvotes: 356
Views: 279576
Reputation: 5961
On the tab:
You can access all derived data and clear by deleting them.
Upvotes: 48
Reputation: 1974
XCODE 10 UPDATE
Click to Xcode at the Status Bar Then Select Preferences
In the PopUp Window Choose Locations before the last Segment
You can reach Derived Data folder with small right icon
Upvotes: 4
Reputation: 49730
Yes, you can delete all files from DerivedData
sub-folder (Not DerivedData Folder)
directly.
That will not affect your project work. Contents of DerivedData
folder is generated during the build time and you can delete them if you want. It's not an issue.
The contents of DerivedData
will be recreated when you build your projects again.
Xcode8+ Update
From the Xcode8 that removed project option from the window tab so you can still use first way:
Xcode -> Preferences -> location -> click on small arrow button as i explain in my first answer.
Xcode7.3 Update For remove particular project's DeriveData you just need to follow the following steps:
Go to Window -> Project
:
You can find the list of project and you can either go the DerivedData
Folder or you can direct delete individual Project's DerivedData
I am not working on Xcode5 but in 4.6.3 you can find DerivedData
folder as found in the below image:
After clicking on Preferences..
You get this window
Upvotes: 431
Reputation: 723
XCode 8: To delete derived data for your current project:
Click Product menu
Hold Option key
Click Clean Build Folder
Upvotes: 12
Reputation: 668
yes, safe to delete, my script searches and nukes every instance it finds, easily modified to a local directory
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
IFS=$'\n\t'
for drive in Swap Media OSX_10.11.6/$HOME
do
pushd /Volumes/${drive} &> /dev/null
gfind . -depth -name 'DerivedData'|xargs -I '{}' /bin/rm -fR '{}'
popd &> /dev/null
done
Upvotes: 1
Reputation: 2226
(Also works for 7.1.1)
Like this:
And then delete it here:
Hope that helps!
Upvotes: 34
Reputation: 51951
$ du -h -d=1 ~/Library/Developer/Xcode/*
shows at least two folders are huge:
1.5G /Users/horace/Library/Developer/Xcode/DerivedData
9.4G /Users/horace/Library/Developer/Xcode/iOS DeviceSupport
Feel free to remove stuff in the folders:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
and some in:
open ~/Library/Developer/Xcode/iOS\ DeviceSupport/
Upvotes: 25
Reputation: 27365
I purge derivedData often enough that I have an alias for it. It can fix build problems. I have the following in /Users/Myusername/.bash_profile
alias purgeallbuilds='rm -rf ~/Library/Developer/Xcode/DerivedData/*'
Then in terminal, I type purgeallbuilds, and all subfolders of DerivedData are deleted.
Upvotes: 138
Reputation: 36447
The content of 'Derived Data' is generated during Build-time. You can delete it safely. Follow below steps for deleting 'Derived Data' :
Upvotes: 0
Reputation: 6606
I would say it's safe--I often delete the contents of the folder for many kind of iOS projects, this way. And, I haven't had any issues with builds or submitting to the App Store. The procedure deletes derived data and cleans a project's cached assets, for both Xcode 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.
Upvotes: -1
Reputation: 5414
Just created a github repo with a small script, that creates a RAM disk. If you point your DerivedData folder to /Volumes/ramdisk
, after ejecting disk all files will be gone.
It speeds up compiling, also eliminates this problem
Best launched using DTerm
Upvotes: 18