Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I safely delete contents of Xcode Derived data folder?

Tags:

xcode

ios

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

  • Found an existing build project folder for an app that I have available on Appstore
  • Deleted the folder from derived dir
  • launched XCode 5
  • Open that project
  • Clean Build
  • Tested and compiled it on a simulator
  • ReArchived
  • Everything worked. Nothing was broken.

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.

like image 996
Sam B Avatar asked Sep 21 '13 13:09

Sam B


People also ask

Should I delete derived data Xcode?

The place where a large number of files were created this way is the DerivedData folder. Its size can be from a few hundred MB to dozens of GB. Luckily, you're fine with deleting files in this folder. There will be no consequences to this action and the benefit you will gain is more space on your Mac.

Is it safe to delete user data Xcode?

As it is user data, no big issue if you delete it completely but it's safer to use 'Reset Content and Settings' option from the menu to delete all of your app data in a Simulator.

What is derived data folder in Xcode?

DerivedData is a folder located in ~/Library/Developer/Xcode/DerivedData by default. It's the location where Xcode stores all kinds of intermediate build results, generated indexes, etc. DerivedData location can be configured in Xcode preferences (Locations tab).


2 Answers

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:

enter image description here

You can find the list of project and you can either go the DerivedData Folder or you can direct delete individual Project's DerivedData

enter image description here


I am not working on Xcode5 but in 4.6.3 you can find DerivedData folder as found in the below image:

enter image description here

After clicking on Preferences..

enter image description here

You get this window

enter image description here

like image 184
Nitin Gohel Avatar answered Sep 22 '22 01:09

Nitin Gohel


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.

like image 37
William Jockusch Avatar answered Sep 23 '22 01:09

William Jockusch