Xcode Quick Fix - Clear Cache

This note has some way to clean/reset Xcode data/setting, which may lead to fix your Xcode crashes, unwanted project errors etc. Following steps are master reset for your Xcode, follow these steps in sequence and after each step check whether problem is solved or not.

1. Clean the Build

If there is any issue in the project build, then first step is to clean the build, which will clean the build and make a new build from scratch next time when you run the code. To clean the build you can use the shortcut Command+Shift+K or Menu Bar → Product → Clean.

2. Clean the Build Folder

This will delete all of the products and intermediate files in the build folder. To clean the build folder you can use the shortcut Command+Option+Shift+K or Menu Bar → Product → Hold Option Key → Clean build Folder.

3. Reset the Simulator Content and Settings

This will delete all installed applications, content, and settings. To reset the simulator launch the iOS Simulator and then go to the Menu Bar → iOS Simulator → Reset Contents And Settings

4. Delete Derived Data

By deleting derived data Xcode will recreates Derived Data when it index your files. To delete derived data go to the Menu Bar → Window → Organizer → Projects → Select Your Project
Right Pane shows the name of folder and also delete button at the right side of the button allows you to delete all derived data contents. You can refer the screenshot.

4.1 Delete the Module Cache

Deleting the module cache will help to fixed code completion errors etc. To delete the module cache close the Xcode and delete the ~/Library/Developer/Xcode/DerivedData/ModuleCache directory.

4.2 Delete Xcode Preferences

This is our final step to fix Xcode crashes by reseting Xcode's preferences. Run this command in your terminal:

defaults delete com.apple.dt.Xcode

Share Tweet Send

Discussion

Community Guidelines
You've successfully subscribed to Developer Insider
Great! Next, complete checkout for full access to Developer Insider
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.