As a Swift developer who’s been working with Xcode for years, I’ve learned that keeping your development environment clean is necessary for maintaining optimal performance. In this guide, I’ll show you how to effectively clean up Xcode-related files, free up precious disk space, and boost your development workflow.
Why Does Xcode Take Up So Much Space?
Before we dive into cleaning, let’s understand what Xcode stores and why:
- Build System Files: Xcode’s build system creates intermediate files to speed up subsequent builds
- Indexing Data: For code completion and quick navigation
- Debug Symbols: For debugging your apps
- Simulator Files: For testing on different iOS versions and devices
- Cache Files: To improve compilation speed
- Documentation: For offline access to Apple’s documentation
Let’s dive deep into each category and understand what’s safe to remove.
Checking Your Disk Space on Mac
You can go to system settings, storage to see how much storage is used:

You can click on the info icon in the “Developer” section to see more details of Xcode files:

You can see how much space is related to Xcode. In my cases it takes 60GB. You can use system settings to clear some space like “Xcode Caches”.
Unfortunately, using settings is not giving all information about Xcode files. To see this better I wrote a small menu bar app that checks all relevant folders and displays the space they take up:


I found folders that are totaling to 160 GB. It is not advices to delete them all, but i managed to free up >100GB with the process I will show you now. I would advice you to clean up you computer once a year.
Clearing Derived Data
The Derived Data folder is often the biggest storage culprit. It contains intermediate build files, indexes, and logs.
How to Remove Derived Data:
# Method 1: Using Terminal
rm -rf ~/Library/Developer/Xcode/DerivedData/*
# Method 2: Open Finder and Navigate to the Folder
open ~/Library/Developer/Xcode/DerivedData
# Method 3: Through Xcode
# Xcode → Preferences → Locations → Derived Data → Click Arrow → Show in Finder

Pro Tip: Instead of deleting everything, you can selectively delete project folders within DerivedData if you’re working on multiple projects.
Removing Device Support Files
What are Device Support Files?
These files contain debugging symbols and support files for iOS devices you connect to your Mac. They’re crucial for debugging on physical devices.
Safe Cleaning Approach
Instead of deleting everything, remove only old iOS versions you no longer support:
# Navigate to device support
open ~"/Library/Developer/Xcode/iOS DeviceSupport"
#Delete older iOS versions
In the blow case, you can see that I gave support for iOS support for 17.6, 18.1 and 18.1.1 Each of these takes up ca. 4GB. In my case this is fine and I will not delete any.

Warning: Keep files for iOS versions you actively support! Removing current versions will force Xcode to download them again when connecting devices.
Cleaning Archives
Archives contain:
- Built applications
- Debug symbols
- Distribution certificates
- Build logs
Old archives can take up significant space. Here’s how to manage them:
# Navigate to Archives folder
open ~/Library/Developer/Xcode/Archives
# Remove archives you no longer need
Best Practice: Before deleting archives:
⁃ Keep archives of App Store submissions
⁃ Maintain archives of important release versions
⁃ Export archives you want to keep to a separate backup
Xcode Playground Cashes
Xcode Playground generate additional files which you can remove as following:
# Clean Playground Files
rm -rf ~/Library/Developer/XCPGDevices/*
Xcode Previews
When you run Xcode 15 previews, it will reuse the same files as from the build. However prior to Xcode 15, it generated a lot more junk.
# Open Xcode Previews folder
open ~/Library/Developer/Xcode/UserData/Previews
Please, do not manually delete files in this folder, otherwise Xcode previews might not work correctly.
To safely delete the preview files use xcrun in terminal like so:
xcrun simctl --set previews delete all
Cleaning Caches
Xcode maintains various caches that you can safely clear:
# Clean CoreSimulator caches
rm -rf ~/Library/Developer/CoreSimulator/Caches/*
Managing Simulators and Runtime Files
Simulator files can consume a lot of space. You can check Xcode to see how many simulators are used:

You can delete them in Xcode:

When using xcrun, make sure it is correctly set up. You can run the following in terminal:
sudo xcode-select --reset
I would recommend to work with the terminal. Here’s how to manage them:
# List all simulators
xcrun simctl list devices
# Remove only unavailable simulators
xcrun simctl delete unavailable
# Remove specific simulator
xcrun simctl delete "iPhone 11 Pro Max"
# Reset all simulator content and settings
xcrun simctl erase all
You can also manage these in Xcode:
- go to “Manage Run Destinations ….”
- choose “Simulator” tap
- select a simulator and press “-” to delete
Managing Simulator Runtime Files
Xcode downloads runtimes. You can manage them in Xcode Settings under the “components” tab:

Every time you update Xcode, it will ask you to download a new runtime. In my case, I used the Xcode 15 beta versions which each time downloaded the iOS 18 beta version. These runtimes can take up a lot of space. After I had my computer for 3 years, it went up to > 100GB.
You can delete runtimes from Xcode or use the terminal like so:
# List simulator runtimes
xcrun simctl runtime list
// delete unavailble runtimes e.g. removes iOS 15 if you run Xcode 15
xcrun simctl runtime delete unavailable
Conclusion
Maintaining a clean Xcode environment is crucial for optimal development performance, but it’s important to be selective about what you delete. Regular maintenance using these safe cleaning methods will help keep your development environment running smoothly while preserving essential files.
Remember:
- Never delete all device support files
- Keep archives of important releases
- Regularly clean Derived Data
- Maintain simulators for active iOS versions
By following these guidelines, you’ll maintain a clean and efficient development environment without risking your ability to debug and build projects effectively.
Note: Always ensure you have a backup of important files before performing any cleanup operations, and when in doubt, use Xcode’s built-in cleanup options rather than manual deletion.