How can I prevent Xcode 4.2 from filling my boot drive with preamble.pch files?

StackOverflow https://stackoverflow.com/questions/7776073

  •  10-02-2021
  •  | 
  •  

Вопрос

There's an issue in Xcode 4.2, where Xcode will fill my boot drive with tens of GB of preamble.pch-****** files, someplace within /private/var/folders/.

Does anybody know how to prevent this from happening?

This means I have to manually empty these files every few hours (quitting/restarting Xcode if necessary), to prevent my boot drive from filling up. I'd (likely) rather revert to the old behavior than create some script or program to systematically remove these every hour, if possible.

Misc:

  • My builds do not use precompiled headers (it looks like these are being generated by Xcode's text editors, using Clang's code sense indexing).
  • Tens of GB is a lot for my boot partitions; I use several small partitions.

Thanks

Это было полезно?

Решение

I’m no clang expert, but a quick glance at lib/Frontend/ASUnit.cpp reveals that GetPreamblePCHPath() will use the value of three environment variables — in order: TMPDIR, TEMP and TMP — before defaulting to /tmp as the location of preamble PCH files. One (not really ideal) solution is to set one of those variables to a directory residing in another volume.

Другие советы

Disabling Xcode's code sense indexing is one way to work around this. Still, this is not always ideal, and I am open to other solutions.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top