Can I safely delete contents of Xcode Derived data folder?
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
How can I delete derived data in Xcode 8?
Many different solutions for this problem. Most of them work as well.
Another shortcut seems to be added as well:
Shift + alt + command ⌘ + K
Will ask you to:
Are you sure you want to clean the build folder for “MyProject”?
This will delete all of the products and intermediate files in the build folder.
In most cases this would be enough to solve your problems.
UPDATE
As of Xcode 9 you'll be able to access the Derived Data folder by navigating to
File -> Project Settings
or if you use a Workspace:
File -> Workspace Settings
And press the arrow behind the path:
When can I safely delete Xcode DerivedData folder?
Sadly, deleting DerivedData
has become the catch all to try and remedy build issues. As you already know, you can delete the DerivedData
at any point in time with no issues (unless of course you were building). The nuances as to when it is safe is a little more complicated. In practice I have generally found that significant changes in the code between builds can have issues. Likewise, changing Xcode versions can also have issues. The key words here being can, which does not mean it will.
I do not believe there is any definitive means of knowing when to purge, which is why I think you find most people generally asking "did you remove DerivedData
" as one of the first questions when someone has a build problem.
IMHO, I think there is some subtle caching that Xcode does within DerivedData
, as I've had build failures in weird situations I could not trace. I would not be surprised if Xcode has some subtle bug related to this caching. In general, I only trusted a command line delete of the project's DerivedData
. And if I was extra careful, I'd also purge any associated libraries/frameworks as well as the ModuleCache
(in DerivedData
). There is also some voodoo in the /var/folders
. Not sure if this is still the case, but I have found myself surgically nuking stuff there. Yeah, bad. But I'm also the kind of person that has been known to edit the project.pbxproj file to fix it, so I guess I throw caution to the wind.
Let me ask you this question. What is more important? "bullet-proof" or build times? I've been roped into maintaining or upgrading the build systems for a few apps. I've always done everything as a clean build. This always was fresh pull from source control and then having a defined DerivedData
within the workspace (these were Jenkins builds and was configured to use a clean workspace). This pretty much avoided build issues related to needing to remove DerivedData
. I've seen way too many strange issues occur due to some Xcode voodoo. It is far better to not add red herrings if you have a build error.
If you do find that the builds as well as any tests needed are taking too long, you can start to devise other strategies to help make it more manageable. This becomes very project dependent. For example on a project I was working on, I moved all libs to pre-built versions. For some reason, they had it setup where they had to build all the 3rd party libs (like openssl) during the build process. This also means that the devs incurred this build penalty the first time they built or any time the cleaned.
How can I safely delete in my ~/Library/Developer/Xcode/DerivedData directory?
The Derived Data folder contains all the intermediate build information, debug- and release-built targets, as well as your project's index. It's helpful to delete the derived data when you have odd index problems (code completion not working right, constant re-indexing, or even just a slow project). Deleting the entire folder nukes this information for all projects Xcode 4 knows about.
The Archives folder (a sibling of Derived Data) contains the archived form of your targets. That is, a release build as well as dSYM data for later debugging. This you should not delete if you want to be able to debug deployed versions of your application.
You can nuke the derived data for a given project by opening the Organizer window and selecting the Projects tab. Select the desired project and click the Delete button next to the Derived Data path. This is more of a "surgical strike" for problem projects.
How to Delete derived data in Xcode8?
- Close Xcode
Open Terminal and enter this command
rm -rf ~/Library/Developer/Xcode/DerivedData
How to Delete derived data in Xcode?
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.
how to delete xcode derived data WITHOUT xcode?
Just open Finder and and press command+shift+g a dialog box will appear and paste ~/Library/Developer/Xcode/DerivedData
in the text box and press go.
It will navigate you to the Derived Data
folder.
You can pin it at left side of the Finder to use it in future.
To pin it in Finder just drag and drop derived data folder under favourite option.:)
How to Delete derived data in Xcode?
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.
Xcode DerivedData directory keeps returning after deletion
The error suggests that you have Core Data code generation turned on and also have a copy of the generated code (or at least a file with the same name) in your source code repository. That's why it complains of a duplicate. One is located in your Model
folder, and the generated copy is located in derived data.
You can resolve this by either
- Changing the setting in your data model so that Core Data doesn't generate code for this entity anymore, or
- Deleting your copy and letting Core Data do its thing.
Either is valid and should work. Or, if the files are actually different in some meaningful way, rename yours so that the name doesn't conflict.
On a related note, the derived data folder always comes back because that's where Xcode puts all of the stuff it generates while compiling your project. It's not just generated source code, it's also things like compiled object code files and eventually the app itself. It comes back because that's how Xcode compiles the project.
Related Topics
How to Prevent Tableview Section Head from Sticking While Scrolling
What Are Unwind Segues For and How to Use Them
Attempt to Present Uiviewcontroller on Uiviewcontroller Whose View Is Not in the Window Hierarchy
Undefined Symbols For Architecture Arm64
Uialertcontroller Custom Font, Size, Color
How to Group by the Elements of an Array in Swift
Dateformatter'S Returns Nil For Specific Date Strings Without Time in Swift
Ios: Convert Utc Nsdate to Local Timezone
How to Load Image from Local Path iOS Swift (By Path)
How to Make a Uitextfield Move Up When the Keyboard Is Present - on Starting to Edit
Split a String into an Array in Swift
Nsurlsession/Nsurlconnection Http Load Failed on iOS 9
Status Bar and Navigation Bar Issue in Ios7
Programmatically Set the Initial View Controller Using Storyboards
Ios - Dismiss Keyboard When Touching Outside of Uitextfield
Conditional Binding: If Let Error - Initializer For Conditional Binding Must Have Optional Type