Xcode - free to clear devices folder?
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Overview
Xcode is Apple's integrated development environment (IDE) for macOS, designed specifically for developing software for Apple's platforms, including macOS, iOS, iPadOS, watchOS, and tvOS. It offers a host of features such as a code editor, compiler, debugger, and interfaces for designing GUIs. Despite its powerful capabilities, one common issue developers often face is the accumulation of substantial temporary files over time. This article explains how to clear your devices' folder effectively to free up space, using the "DerivedData" and "Archives" folders as examples.
Understanding Xcode's Devices Folder
The Xcode devices folder primarily contains data related to simulators, device support files, and caches. Here's a breakdown of what you'll typically find:
- Device Support Files: These are essential for running apps on physical devices with different iOS versions. Every time you connect a device with a new iOS version, Xcode may download and cache these support files, consuming considerable disk space.
- Derived Data: This folder contains intermediary build products, index files created as you edit code, and temporary data. This data can accumulate rapidly, especially if you switch between different projects often.
- Archives: These are app archives generated through the Organizer for distribution, storage, and version management. Although crucial for app deployment, over time, they can consume significant disk space.
How to Clear the Devices Folder
Reducing the size of your devices folder can be accomplished through manual or automated methods. Let's discuss both:
Manual Method
- Finding the Devices Folder:
- Open Finder and use
Cmd + Shift + G. - Enter the path:
~/Library/Developer/Xcode/iOS DeviceSupport. - You can delete old device support files that are no longer necessary.
- Clearing Derived Data:
- Navigate to
~/Library/Developer/Xcode/DerivedData. - You can safely delete the entire contents of this folder.
- Deleting Archives:
- Open Xcode and go to
Window > Organizer. - Select the
Archivestab. - Highlight unnecessary archives and delete them.
Automated Method
You can automate cleaning tasks using scripts. Here's a simple shell script to clear cache and derived data:
Related reading
- Xcode - How to fix ''NSUnknownKeyException'', Reason, "… this class is not key value coding-compliant for the key X" error?
- Xcode - How to fix ''NSUnknownKeyException'', Reason … this class is not key value coding-compliant for the key X error?
- Xcode - Is there a way to drag a component from one view to another without losing its frame?
- Xcode - ld library not found for -lPods
- Xcode - There are no dSYMs available for download
- Xcode 10.2.1 Command PhaseScriptExecution failed with a nonzero exit code
- Xcode 10.2 Failed to Run App on Simulator with iOS 10
- Xcode 10.2 Update issue Build system error -1 Unable to load contents of file list input/output xcfilelist
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.