Live
Black Hat USADark ReadingBlack Hat AsiaAI BusinessIs cutting ‘please’ and ‘thank you’ when talking to ChatGPT better for the planet? An expert explains - The IndependentGoogle News: ChatGPTOpenAI CEO and CFO Diverge on IPO Timing - The InformationGoogle News: OpenAII built a faster alternative to cp and rsync — here's how it worksDEV CommunityThe Service Layer: Where Separate Components Become a SystemDEV Community🚀Playwright vs Selenium in 2026: The Ultimate Guide for Modern Test AutomationDEV CommunityBuilding a Decentralized Mesh Network in Rust — Lessons from the Global SouthDEV CommunitySocratic AI: how I learned formal grammars (and built a compiler) without losing control of what I was buildingDEV CommunityAsimov's Laws Confront Real-World AI Ethics - 조선일보Google News - AI roboticsA simple explainer on what quantum computing actually is, and why it is terrifying for bitcoinCoinDesk AIOpenAI Is Making Microsoft and Ashton Kutcher Incredibly Rich - inc.comGoogle News: OpenAIShielding Your LLMs: A Deep Dive into Prompt Injection & Jailbreak DefenseDEV CommunityQodo vs Tabnine: AI Coding Assistants Compared (2026)DEV CommunityBlack Hat USADark ReadingBlack Hat AsiaAI BusinessIs cutting ‘please’ and ‘thank you’ when talking to ChatGPT better for the planet? An expert explains - The IndependentGoogle News: ChatGPTOpenAI CEO and CFO Diverge on IPO Timing - The InformationGoogle News: OpenAII built a faster alternative to cp and rsync — here's how it worksDEV CommunityThe Service Layer: Where Separate Components Become a SystemDEV Community🚀Playwright vs Selenium in 2026: The Ultimate Guide for Modern Test AutomationDEV CommunityBuilding a Decentralized Mesh Network in Rust — Lessons from the Global SouthDEV CommunitySocratic AI: how I learned formal grammars (and built a compiler) without losing control of what I was buildingDEV CommunityAsimov's Laws Confront Real-World AI Ethics - 조선일보Google News - AI roboticsA simple explainer on what quantum computing actually is, and why it is terrifying for bitcoinCoinDesk AIOpenAI Is Making Microsoft and Ashton Kutcher Incredibly Rich - inc.comGoogle News: OpenAIShielding Your LLMs: A Deep Dive into Prompt Injection & Jailbreak DefenseDEV CommunityQodo vs Tabnine: AI Coding Assistants Compared (2026)DEV Community
AI NEWS HUBbyEIGENVECTOREigenvector

How to Clean Up Xcode and Free 30-50GB on Your Mac

DEV Communityby Sergey NikiforovApril 4, 202611 min read1 views
Source Quiz

Xcode is the single biggest storage consumer on most developers' Macs. A fresh install starts around 35GB, but over months of development it quietly grows to 80, 100, even 150GB+. Most of that growth is invisible — cached build products, old simulators, debug symbols for iOS versions you no longer use. I've been building iOS apps for years, and this problem is exactly why I built MegaCleaner — I got tired of manually tracking down these hidden folders every few months. But whether you use a tool or do it by hand, you should know where the space goes. This guide covers every Xcode storage category: what it is, where it lives, how big it typically gets, and whether it's safe to delete. No guesswork, no vague advice — just exact paths and clear safety levels. Quick Reference Before we dive in

Xcode is the single biggest storage consumer on most developers' Macs. A fresh install starts around 35GB, but over months of development it quietly grows to 80, 100, even 150GB+. Most of that growth is invisible — cached build products, old simulators, debug symbols for iOS versions you no longer use.

I've been building iOS apps for years, and this problem is exactly why I built MegaCleaner — I got tired of manually tracking down these hidden folders every few months. But whether you use a tool or do it by hand, you should know where the space goes.

This guide covers every Xcode storage category: what it is, where it lives, how big it typically gets, and whether it's safe to delete. No guesswork, no vague advice — just exact paths and clear safety levels.

Quick Reference

Before we dive in, here's the full picture. Bookmark this table — you'll want it next time your Mac complains about storage.

Category Path Typical Size Safe to Delete?

DerivedData ~/Library/Developer/Xcode/DerivedData 10-50 GB Yes — rebuilds automatically

Simulators ~/Library/Developer/CoreSimulator/Devices 20-150 GB Yes for old versions

Archives ~/Library/Developer/Xcode/Archives 5-30 GB Yes if older than 6 months

Device Support ~/Library/Developer/Xcode/iOS DeviceSupport 10-40 GB Yes for old iOS versions

Module/Doc Cache ~/Library/Developer/Xcode/DocumentationCache 1-5 GB Yes — regenerates

Old Xcode Versions /Applications/Xcode*.app 12-30 GB each Verify first*

CocoaPods Cache ~/Library/Caches/CocoaPods 1-5 GB Yes — pod install restores

SPM Cache ~/Library/Caches/org.swift.swiftpm 1-5 GB Yes — swift package resolve restores

Total potential savings: 30-150+ GB depending on how long you've been developing.

Now let's go through each one.

1. DerivedData

What it is: Every time you build a project in Xcode, it stores compiled objects, indexes, logs, and debug info in a project-specific subfolder. These are named ProjectName-uniqueID (the unique ID is a 28-character hash), so you can identify which project each folder belongs to.

Where it lives:

~/Library/Developer/Xcode/DerivedData/

Enter fullscreen mode

Exit fullscreen mode

How big it gets: 10-50 GB depending on how many projects you work on. Each active project adds 500 MB to several GB of build artifacts. Since Xcode never cleans these up automatically, they accumulate forever.

How to clean it:

From Terminal — delete everything:

rm -rf ~/Library/Developer/Xcode/DerivedData/*

Enter fullscreen mode

Exit fullscreen mode

Or selectively — delete a specific project's cache:

rm -rf ~/Library/Developer/Xcode/DerivedData/MyProject-*

Enter fullscreen mode

Exit fullscreen mode

From Xcode — go to Settings > Locations, click the small arrow next to the DerivedData path to open it in Finder, then select and delete the contents.

Is it safe? Yes. DerivedData is completely regenerated on your next build. The only cost is a slightly longer first build after cleaning — typically 1-5 minutes depending on project size. This is the single safest cleanup you can do.

Pro tip: If you're mid-project and don't want to rebuild everything, delete only the folders for projects you haven't touched in a while. The folder names include the project name, so it's easy to tell which is which.

2. Simulators and Runtimes

What they are: iOS, watchOS, tvOS, and visionOS simulator instances — full virtual devices that Xcode uses for testing. Each runtime version (iOS 17.5, iOS 18.2, etc.) is a separate download, and each simulated device (iPhone 16 Pro, iPad Air, etc.) creates its own data folder.

Where they live:

~/Library/Developer/CoreSimulator/Devices/

Enter fullscreen mode

Exit fullscreen mode

How big they get: This is typically the largest category — 20-150 GB. Each simulator runtime is 5-8 GB. If you've been developing through multiple iOS versions (17, 18, 26), the runtimes alone can be 30-50 GB. Add device data folders and it grows fast.

How to clean it:

First, remove simulators for iOS versions that Xcode no longer supports:

xcrun simctl delete unavailable

Enter fullscreen mode

Exit fullscreen mode

List all installed simulators to see what you have:

xcrun simctl list devices

Enter fullscreen mode

Exit fullscreen mode

Delete a specific simulator by its UUID:

xcrun simctl delete

Enter fullscreen mode

Exit fullscreen mode

Remove old runtimes you no longer need:

xcrun simctl runtime delete "iOS 17.5"

Enter fullscreen mode

Exit fullscreen mode

You can also manage simulators in Xcode: Window > Devices and Simulators, then right-click any device to delete it.

Is it safe? For old iOS versions (more than 2 major versions behind), absolutely — you're never going to debug against iOS 16 when you're building for iOS 26. For current versions, it's safe but you'll need to re-download the runtime if you delete it (5-8 GB download).

Watch for orphans: Sometimes simulator device folders survive crashes or manual cleanup attempts. These folders exist on disk but don't appear in xcrun simctl list. They're dead weight — safe to delete.

3. Archives

What they are: .xcarchive bundles created every time you build for distribution (Product > Archive). Each archive contains the compiled app, debug symbols (dSYMs), and metadata. They're organized by date in subfolders like 2026-03-15/.

Where they live:

~/Library/Developer/Xcode/Archives/

Enter fullscreen mode

Exit fullscreen mode

How big they get: 5-30 GB. Individual archives range from 100 MB to 2+ GB depending on app size. If you archive regularly, this adds up.

How to clean it:

From Xcode — Window > Organizer > Archives. Right-click an archive and select Delete.

From Terminal — remove archives older than 6 months:

find ~/Library/Developer/Xcode/Archives -name "*.xcarchive" -mtime +180 -exec rm -rf {} +*

Enter fullscreen mode

Exit fullscreen mode

Is it safe? For archives older than 6 months: yes. The main reason to keep archives is their dSYM files, which you need to symbolicate crash reports. If you've uploaded the build to App Store Connect, Apple retains the dSYMs — so your local copy is redundant.

For recent archives of builds currently in production: keep them until you've confirmed the dSYMs are uploaded.

4. Device Support Files

What they are: Debug symbol caches that Xcode downloads when you connect a physical iPhone, iPad, or Apple Watch. They allow Xcode to symbolicate crash logs and debug on-device.

Where they live:

~/Library/Developer/Xcode/iOS DeviceSupport/ ~/Library/Developer/Xcode/watchOS DeviceSupport/

Enter fullscreen mode

Exit fullscreen mode

Folder names follow the format DeviceModel version (build) — for example, iPhone15,3 17.4 (21E219). In older Xcode versions, the format was just 17.4 (21E219) without the device model prefix.

How big they get: 10-40 GB. Each iOS version creates a 2-5 GB folder. If you've been developing through several iOS releases, these pile up fast.

How to clean it:

Just delete the folders for old iOS versions you're no longer debugging against:

rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*\ 16.* rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*\ 17.*

Enter fullscreen mode

Exit fullscreen mode

Keep the folders matching the iOS versions currently on your devices.

Is it safe? For old versions (2+ major versions behind your current iOS): completely safe. These are cached copies — Xcode will re-download them if you ever connect a device running that version again. For your current iOS version: keep it, or you'll trigger a re-download next time you plug in your device.

5. Module and Documentation Cache

What it is: Pre-built module indexes and documentation caches that Xcode creates for quick access to API docs and symbol lookup.

Where they live:

~/Library/Developer/Xcode/DocumentationCache/ ~/Library/Developer/Shared/Documentation/

Enter fullscreen mode

Exit fullscreen mode

How big they get: 1-5 GB combined. Not the biggest offender, but easy to clean.

How to clean it:

rm -rf ~/Library/Developer/Xcode/DocumentationCache/* rm -rf ~/Library/Developer/Shared/Documentation/*

Enter fullscreen mode

Exit fullscreen mode

Is it safe? Yes. These are fully auto-regenerated by Xcode when needed. No downsides.

6. Old Xcode Versions

What it is: If you've ever installed multiple Xcode versions side-by-side (common when testing against beta versions or maintaining legacy projects), the old versions may still be sitting in your Applications folder.

How to find them:

Check which Xcode is your active version:

xcode-select -p

Enter fullscreen mode

Exit fullscreen mode

This returns something like /Applications/Xcode.app/Contents/Developer — meaning Xcode.app is your active version.

Now check for other Xcode installations:

ls -la /Applications/Xcode*.app ls -la ~/Applications/Xcode*.app

Enter fullscreen mode

Exit fullscreen mode

How big they get: 12-30 GB per version. Having Xcode 15 and Xcode 16 both installed wastes 25-35 GB.

How to clean it: Move the old versions to Trash. If you're sure you don't need them:

sudo rm -rf /Applications/Xcode-15.4.app

Enter fullscreen mode

Exit fullscreen mode

Is it safe? Only if you no longer need the old version. Some developers keep older Xcode versions for building against older SDKs or submitting to the App Store with specific toolchain requirements. Verify before deleting.

7. CocoaPods and SPM Caches

What they are: Cached downloads and build artifacts from dependency managers — CocoaPods and Swift Package Manager.

CocoaPods

~/Library/Caches/CocoaPods/ # Downloaded pod cache ~/.cocoapods/repos/ # Spec repositories

Enter fullscreen mode

Exit fullscreen mode

Clean with:

rm -rf ~/Library/Caches/CocoaPods rm -rf ~/.cocoapods/repos

Enter fullscreen mode

Exit fullscreen mode

Restore with pod install in your project. Specs restore with pod repo update.

Swift Package Manager

~/Library/Caches/org.swift.swiftpm/ # Package cache

Enter fullscreen mode

Exit fullscreen mode

Clean with:

rm -rf ~/Library/Caches/org.swift.swiftpm

Enter fullscreen mode

Exit fullscreen mode

Restore with swift package resolve in your project.

Project-level folders

Don't forget per-project Pods/ directories and .build/ folders in Swift packages. These can be large but are fully regenerated by their respective dependency managers.

Combined size: 1-10 GB depending on how many projects you work on.

Is it safe? Yes. Dependency manager caches are fully regenerated. The only cost is re-download time on your next pod install or swift package resolve.

What NOT to Delete

Not everything should be deleted at once. Here's what to keep:

Active project DerivedData. If you're in the middle of working on a project, deleting its DerivedData means a full rebuild — which can take 5-30 minutes on large projects. Clean stale projects, keep active ones.

SPM package cache on slow connections. The ~/Library/Caches/org.swift.swiftpm directory caches all downloaded packages. On a slow network, re-downloading everything takes time. If bandwidth isn't an issue, delete freely.

Current iOS Device Support. If you're actively debugging on a device running iOS 18.5, keep the 18.5 (...) folder. Deleting it means Xcode will need to re-download it the next time you connect your device.

Recent archives you haven't uploaded. If you archived a build for App Store distribution but haven't submitted it yet, you need that archive. Once it's uploaded to App Store Connect, the local copy is safe to delete.

The Automated Way

If hunting through all these paths manually every few months sounds tedious — it is. That's exactly why I built MegaCleaner.

MegaCleaner scans all 6 Xcode storage categories (DerivedData, simulators, archives, device support, docs, old versions) plus CocoaPods and SPM caches — and it doesn't stop at Xcode. It covers 29 tools total (21 developer tools + 8 system categories), including Docker, node_modules, Python environments, Rust/Cargo, Homebrew, and more.

How it works:

  • Scan is free — see exactly how much space each tool wastes

  • Confidence levels — every item is marked as "definitely safe" (like DerivedData), "probably safe" (like old archives), or "verify first" (like old Xcode versions)

  • One click — select what to clean, hit Clean, done. Everything goes to Trash (undoable)

  • $49 one-time — not a subscription

If you only care about Xcode cleanup, DevCleaner for Xcode is a solid free alternative. It covers similar Xcode categories but doesn't touch other dev tools.

Tool Comparison

Feature MegaCleaner DevCleaner CleanMyMac

Price $49 one-time Free (tip jar) $90/year

Xcode cleanup 6 sub-features 6 categories Basic cache only

Other dev tools 20 more (Docker, npm, Python...) None None

Safety levels 3 confidence tiers No No

Open source No Yes (GPL-3) No

Dev tool intelligence Yes — 21 dev tool scanners Xcode only No dev awareness

Summary

Xcode can quietly consume 30-100+ GB of your disk without any visible sign. At a minimum, do this quarterly:

  • Delete DerivedData for stale projects — instant win, zero risk

  • Remove old simulator runtimes — usually the biggest savings

  • Clean Device Support for old iOS versions — easy 10-20 GB

  • Check for old Xcode versions in /Applications — 12-30 GB each

The manual cleanup takes 10-15 minutes if you follow this guide. Or scan with MegaCleaner and do it in under a minute.

Either way, your Mac will thank you.

Was this article helpful?

Sign in to highlight and annotate this article

AI
Ask AI about this article
Powered by Eigenvector · full article context loaded
Ready

Conversation starters

Ask anything about this article…

Daily AI Digest

Get the top 5 AI stories delivered to your inbox every morning.

More about

modelreleaseavailable

Knowledge Map

Knowledge Map
TopicsEntitiesSource
How to Clea…modelreleaseavailableversionupdateopen sourceDEV Communi…

Connected Articles — Knowledge Graph

This article is connected to other articles through shared AI topics and tags.

Knowledge Graph100 articles · 176 connections
Scroll to zoom · drag to pan · click to open

Discussion

Sign in to join the discussion

No comments yet — be the first to share your thoughts!

More in Releases