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

时光怂恿深爱的人放手 提交于 2019-12-23 09:17:47

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/7776073/how-can-i-prevent-xcode-4-2-from-filling-my-boot-drive-with-preamble-pch-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!