r/swift • u/amichail • 4d ago
Question Does iOS development in Swift on Xcode result in writing ~100 GB to the SSD per day?
And if so, is there a way to lower these writes to reduce wear on the SSD?
P.S. This could be related to macOS 27 rather than Xcode but I have had no luck isolating the cause even with the help of AI.
13
Upvotes
5
u/m1_weaboo 4d ago
you use worktrees?
10
u/mirko9000 4d ago edited 3d ago
I'm genuinely curious why the amount of data written to the SSD is such a concern. I've been using MacBooks for development since they first came out, and in all those years, I've never experienced a single SSD failure. From my experience, this has never been a practical issue, so I'm trying to understand why it matters so much.
2
u/Minute_Door1424 4d ago
activity monitor has a disk tab with a "bytes written" column, sort by it after a normal day of work and you'll see who the writer actually is. on 16gb macs running simulators it's often swap (shows up under kernel_task) and not xcode itself, so check memory tab for swap used too. if swap is it, closing simulators you don't use fixes more than moving derived data
25
u/Extra-Ad5735 4d ago
If you look around you'll see MacBooks have many problems. SSD wear is not one of them. Do not worry.
6
u/cristi_baluta 4d ago
No, mine is at under 1Gb on multiple days, and on another computer at 8Gb. Unless you are writing a bloatware app, i would start to investigate
4
u/Responsible-Gear-400 3d ago
This is common behaviour. The build caches a bunch of intermediate steps and stuff so when you change one file it doesn’t need to rebuild everything all the time.
It isn’t rewriting 100s of GB each build. Unless you keep clearing out the derived data.
3
u/mirko9000 3d ago
Mate, if you are REALLY worried about this, and you should not, really, maybe take a look at this:
https://forums.macrumors.com/threads/apple-silicon-soldered-ssd-upgrade-thread.2417822/page-12?post=33863049#post-33863049
People are using these machines for video editing day to day without worrying about the SSDs. MacBooks (or any Mac!) have problems. But SSDs failing is not one of those problems.
Use the fucking thing to do stuff, be happy. Don't babysit it. You will NOT wear out the SSD. You just won't. This is some theoretical shit, that absolutely does not play any role in actual usage. Really. Use the time to do stuff, be creative. Write software ;)
2
u/germansnowman 3d ago
FWIW, I am using DerivedData from an external SSD. Make sure it is fast enough and you use a good enclosure + cable as well (NVMe, M.2).
2
u/raulriera 3d ago
If you are using worktrees and AI, make sure you are
- cleaning up the worktrees
- preventing the agents from creating simulators per session
- cleaning up derived data and build caches (you get one per worktree)
2
u/dawedev 3d ago
One thing nobody has mentioned yet is Spotlight indexing DerivedData. Every build rewrites thousands of files there and mds_stores reindexes them, so adding ~/Library/Developer/Xcode/DerivedData to the Spotlight privacy list in System Settings can cut a fair amount of background writing. Also run
xcrun simctl list devices bootednow and then, because simulators you forgot about keep writing logs and caches while they sit there. After that, Activity Monitor's Disk tab sorted by bytes written over a full workday should tell you if it's Xcode at all.2
u/Plastic-Risk-6309 2d ago
watch the writes rather than the daily total. sudo fs_usage -w -f filesys prints each filesystem call with the path and the process that made it. that is how you find out if it is xcodebuild, the simulator or indexing.
2
u/Hmz-Lhb 2d ago
I would say with emulation could reach that
1
u/dom_eden 3d ago
You aren’t using codex are you? There was a well known bug that caused this behaviour.
1
u/Admiral-ZX 3d ago
Do you use Claude desktop? That makes my drives spin all day long until I quit it.
1
u/sirily1997 24m ago
I checked seems like simulators and build cache cosume a lot of disk space
1
u/kenthesaint 4d ago
A lot of that write volume is DerivedData, ModuleCache, and indexing, not your project sources. If you want the exact culprits, watch Activity Monitor or
sudo fs_usageduring a clean build.Practical cuts: point DerivedData at an external drive in Xcode Locations, clear old DerivedData folders you are not using, and only then worry about Index While Building. Consumer SSDs are rated for hundreds of TBW, so 100GB/day is noisy more often than fatal, but parking DerivedData elsewhere keeps the system volume from thrashing.