Tips to Clean the Xcode Cache and Stop Crashes
Xcode is a popular Integrated Development Environment (IDE) for macOS. It is meant to provide software developers with access to all the tools they need to enhance their job and performance. However, as you build and test software using Xcode, the cache of the software may quickly fill up with old and unnecessary files. Some software projects can use a lot of disk space, so it is not uncommon for developers to eventually run out of disk space.
If you are an Xcode users, you may want to consider regularly cleaning the Xcode cache. This will not only reduce disk space usage but can help prevent Xcode crashes as well. Keep in mind that when we get to the part where we delete the Xcode cached folders and files, you will need to quit the app first. But before this:
Table of Contents
Clean your Xcode Build
An improper configuration of your current Xcode build may result in crashes and instability. To clean your Xcode build, you should do this:
- Open your project and head to the top menu bar.
- Select Product -> Clean.
You can also clean out the builder by:
- Open the project, and head to the Product menu you used earlier. Hold down the Option key while hovering it to uncover advanced options.
- Select Clean Build Folder.
Reset Content and Settings
Xcode uses a simulator to run certain apps and scripts. If it has been clogged because of poorly written code, then it might lead to Xcode crashes and instability. Go to the Simulator menu and select Reset Content and Settings. Keep in mind that you will need to re-apply any configuration changes you had previously made.
Clean Xcode Derived Data
The Derived Data directory is where Xcode stores all sorts of build info and project indexes. Make sure to back up all your projects before cleaning out this folder.
- Open Xcode and go to Window -> Organizer.
- Go to Projects and select the project you are working on.
- You should see a new window with the Derived Data folder inside. Click the Delete button next to it.
After this, open Finder -> Go -> Go to Folder. Enter ~/Library/Developer/Xcode/DerivedData/ModuleCache and move the files inside the trash bin. Make sure to empty it after this.