Xcode freezes on startup while loading project

Check out this: (quoted from here)

Restore sanity by not restoring

Thanks to Lion's Restore feature, all the windows you left open in a given application remain open when you relaunch it. That's awesomely helpful in a Web browser or a text editor. In certain apps, however—particularly those where you rarely need to revisit the same documents—the feature is more of an annoyance. Window resuming is actually configured on an app-by-app basis. Here are the Terminal commands to disable Resume in Preview and QuickTime Player X:

defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false

defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false

Quit the apps before you try the commands. Again, swap "true" for "false" to reverse your change.

You may be able to do something similar for Xcode.

Otherwise, you can quit an application in Lion and discard the previously open windows by holding the option key while pressing CMD+Q. So you could try starting Xcode and quitting it with option held before it's had a chance to open your windows, then re-launch it and it shouldn't try to open the windows. Then you can try to fix the problem.

Update: Here is some additional information from comments that solved the problem...

Now to try and fix the project... Remove the following directories:

MyProject.xcodeproj/xcuserdata
MyProject.xcodeproj/project.xcworkspace/xcuserdata

Those directories store things like window positions, what files are open, which project groups are expanded, etc. so one cause could be if you use source control across multiple machines that have the same username and those files aren't ignored (which they should be if you're using source control). Retina vs. non-retina or different versions of Xcode could use those files differently and the source-control merging could make them inconsistent. So make sure you remove and ignore these directories in source control so that they don't get re-added and cause the problem again.


What fixed this for me was removing unsaved document in ~/Library/Autosave Information. After Xcode launched without any problem.


Using answer in apple.stackexchange.com did the trick for me:

Removing the ~/Library/Saved Application State/com.apple.dt.Xcode.savedState/ directory might help.

If this did not work, then remove ~/Library/Developer (brought from here and here)

Tags:

Ios

Iphone

Xcode