Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 - slow performance

People also ask

Why is my Xcode running so slow?

Running With Low Disk Space If your disk has less than 20GB remaining, then your overall computer will slow down due to low disk space and you may find it hard to do your regular work on your computer. You must keep your disk space free in order to have a smooth working experience.

Why is Xcode so slow on Mac?

With 4GB of RAM, Xcode is going to swap to disk a lot. With a spinning disk, swapping will be slow. If you can upgrade to an SSD and/or add RAM, that will help, otherwise you're kind of stuck.

Why does Xcode take so long to compile?

Xcode has inbuilt features that allow you to identify functions and expressions that are causing longer compile times. You can specify a compile time limit and identify areas in your codebase that exceed this limit. Open up your project's build settings and add the following flags to your Other Swift Flags .


If you purge the workspace file it helps speed it up.

First, make sure Xcode isn't open. Now find your project file. Right-click on it, and select Show Package Contents.

enter image description here

Next, delete project.xcworkspace.

enter image description here

Open Xcode and enjoy faster performance!

Thanks to: http://meachware.blogspot.com/2011/06/speed-up-xcode-4.html


Edit: I've gotten several comments about this noting that for some projects this might cause problems. Make sure you have a backup of your project before performing these steps, and don't forget to check and test your project afterwards. Be sure you still have all of your executables and schemes.


IMPORTANT UPDATE: Paths changed for Xcode 6 (Thanks for the comment dcc)! I just added the alternative way.


There is another nice trick to fasten up builds by creating a ram disk with the following line of code:

diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://8475854`

This creates an in-memory disk image with a size of about 4 GB. But be careful, you need to have enough memory. Of course you can create a smaller image like 2 GB (that would be 4237927).

Then you tell Xcode to store derived data there enter image description here

You cannot tell Xcode to store the iPhone Simulator data there directly, but you can create a folder on the ramdisk and create a symbolic link instead of the iPhone Simulator directory by doing this:

Xcode 6:

cd /Volumes/ramdisk
mkdir CoreSimulator
rm -R ~/Library/Developer/CoreSimulator
ln -s /Volumes/ramdisk/CoreSimulator ~/Library/Developer/CoreSimulator

Older Xcode versions:

cd /Volumes/ramdisk
mkdir iPhone\ Simulator
rm -R ~/Library/Application\ Support/iPhone\ Simulator
ln -s /Volumes/ramdisk/iPhone\ Simulator ~/Library/Application\ Support/iPhone\ Simulator

If I build for the simulator with this setup, it's up and running in no time :)

Be aware that the ram disk will disappear when you restart your machine, so it could be a good idea to create a script or something that runs on startup. AND DON'T PLACE ANY DATA THERE THAT YOU WANT TO KEEP!!!

UPDATE 2013-03-12:

  1. Read the comment from Francisco Garcia below!

  2. With my new MBP (containing a SSD drive) I do not need this method any more. Xcode runs like hell :). I hope this is not seen as advertising for the big fruit concern, it's just an experience report...


Disabling Live Issues in General Preferences has made a definite difference. I also setup a scheme without gdb enabled for situations where I'm frequently re-running (no gdb speeds up launch quite a bit).


For me, Xcode gained a huge performance increase after setting it to run in 32-bit mode (it was 64 by default). It is almost as fast as the old Xcode 3. You can switch to 32 bit by right-clicking the app (in /Developer/Applications/XCode.app) and selecting Get Info and checking Open in 32-bit mode.