How do I keep Xcode from filling up my hard drive?

In regards to Xcode's knack of filling up the hard drive, how do I prevent that from happening?

Accepted Answer

How much free space on your drive right now? Click on the Apple logo, top left in the menu bar, then 'About This Mac', then the 'Storage' tab - how many GB does it say as 'available' on your main drive? What is the total size of that drive?



There were reports of Xcode going nuts and writing temp files that weren't cleared up.


This isn't the same as a routine build up of 'Derived Data' that is normal, and primarily an issue for users with smaller drives who need to budget drive space.


I'd keep an eye on your free space and how long it takes for it to drop significantly.


- If free space is consumed slowly, I'd make an effort to delete derived data as part of your routine housekeeping. See this SO thread: https://stackoverflow.com/questions/46468220/how-to-delete-derived-data-in-xcode-9


- If it drops quickly, that's another issue we can try to tackle when it happens.

Answers

What do you mean ? Is it creating files you don't want ? Or is just XCode too large for your disk ?


Please describe what the problem is and when it occurs.

Are you talking about during normal use or are you seeing the runaway stuf?


How much free space on your drive right now?

I'm addressing the problem I ran into recently. As you may recall, Xcode took a long time Indexing and Prebuilding when I ran a project in Simulator. I force quit. Then I restarted. It wouldn't start properly -- It got to the Apple logo with the progress bar all the way to the right, but it wouldn't go to the login screen. I had to reinstall a clean macOS. KMT said that it might have been due to Xcode filling up my hard drive. I don't know what exatly Xcode would write to disk in that situation. Here's the link to the discussion that pertains to that issue I had.


https://forums.developer.apple.com/thread/97129


KMT said to flush derived data when it was taking a long time indexing and prebuilding. I don't know what that means.

How much free space on your drive right now? Click on the Apple logo, top left in the menu bar, then 'About This Mac', then the 'Storage' tab - how many GB does it say as 'available' on your main drive? What is the total size of that drive?



There were reports of Xcode going nuts and writing temp files that weren't cleared up.


This isn't the same as a routine build up of 'Derived Data' that is normal, and primarily an issue for users with smaller drives who need to budget drive space.


I'd keep an eye on your free space and how long it takes for it to drop significantly.


- If free space is consumed slowly, I'd make an effort to delete derived data as part of your routine housekeeping. See this SO thread: https://stackoverflow.com/questions/46468220/how-to-delete-derived-data-in-xcode-9


- If it drops quickly, that's another issue we can try to tackle when it happens.

I have a total of 499.25 GB total and 457.48 GB available. I just erased my entire drive and reinstalled macOS in order to fix the problem I ran into before. I don't know how fast it took for my drive to fill up before.

Got it, thanks - as I said, keep an eye on it.


Good luck.