---
title: "为XCode 4加速"
author: "miss大为"
date: "2013-08-25T10:57:29Z"
tags: []
categories: ["移动开发"]
slug: "xcode-4"
draft: false
lastmod: "2013-08-25T10:57:29Z"
id: 1930545
url: "https://iphonetrain.iteye.com/blog/1930545"
---

![](http://my.csdn.net/uploads/201207/12/1342105823_7449.png)

  1. XCode 4打开时，自动加载上次的工程，需要较长时间。

     这是因为Lion提供了新功能让应用程序恢复上次关闭时的状态。如果仅是临时不希望下去打开时不要打开现在使用的项目，可以在退出使用CMD+Q+OPTION代替CMD+Q。

   如果默认不希望再打开，就可以使用下面的指令：

              defaults write com.apple.Xcode ApplePersistenceIgnoreState YES

   \*对其它程序，只要改变中间的App ID就可以了。

 

  2. 在Mac Lion下使用XCode 4时，调试大型的工程，速度慢得让人无语。划到一个地方，就可能让你一顿慢悠悠的等待。XCode 4的indexing系统消耗太大，这会导致在调试时经常会卡住。它带来的好处很多，比如自动补全、查找定义等。但为了提升调试的性能，可以使用下面的方式：

                defaults write com.apple.dt.Xcode IDEIndexDisable 1

    * 需要时候，把1改为0就可以了。

 

  3. 编译速度优化

   正像在VS2010使用/MP选项提供多进程编译一样。XCode也有相似的功能，可以使用下面的指令设定:

         defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks 8

         defaults write com.apple.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 8

    * 8是你期望的并行的编译进程数

  

**备注:**

 defaults是Mac OS下用于改写应用程序的Preference文件的指令，而对应的preference文件可以在~/Library/Preferences下找到。

 详细的说明可以官方的这个地址找到: [XCode User Defaults](http://developer.apple.com/library/ios/#documentation/DeveloperTools/Reference/XcodeUserDefaultRef/100-Xcode_User_Defaults/UserDefaultRef.html).