Xcode Crashing When Opening Project File Xcode Crashing When Opening Project File xcode xcode

Xcode Crashing When Opening Project File


The crash is generally a sign the project file has been corrupted. Here's a list of possible things you can do to try to fix it.

1. Fix a corrupted *.pbxproj file

Caused by a merge conflict

If you are using version control, it might be caused by a merge conflict that has not yet been resolved.

  1. Using Finder, open the directory that holds your project.
  2. Right click the project file YOUR_PROJECT_NAME.xcodeproj and Open With your preferred text editing tool such as Sublime Text.
  3. Look for merge conflicts which are usually marked using a series of ========= bars.
  4. Resolve the merge conflicts manually or remove the changes of one side.

Caused by unreadable XML

If that fails go into the file and quickly scroll through to see if anything seems out of place - it should generally be readable XML. You could even try an XML validator against it to see if anything amiss was found.

2. Reset your workspace

  1. Using Finder, open the directory that holds yor project.
  2. Right click the project file MyProject.xcodeproj and choose Show Package Contents.
  3. Delete the xcuserdata folder, which should contain a folder with your username on it.
  4. Repeats step 2 and 3 for your workspace file MyProject.workspace

As elaborated by KennyWinker and Paul R on the answers below.

3. Recreate your Xcode project

Note that this should be your last resort as it is quite tedious to do for large projects.

Lastly you could simply re-create it. That might seem like a big pain, but basically you could just create a new project and drag everything under the "Classes" folder into Xcode to start using it (don't forget to also add the frameworks you need).


Just wanted to elucidate on @Paul R's comment.

I had a situation where Xcode was crashing every time I opened a project file. It seemed to be connect to the IB window that was opening. In the end it was deleting the contents of MyProject.xcodeproj/project.xcworkspace/xcuserdata/ that solved this. It did this by resetting the workspace (open files, window scaling, etc.)

Hope this is helpful.


What worked for me?

The only solution that worked for me was deleting the derived data folders of the hanging project, i.e the derived data folders in above directory: ~/Library/Developer/Xcode/DerivedData/. Hope it helps someone.

What didn't?

As mentioned at other places, deleting MyProject.xcodeproj/project.xcworkspace/xcuserdata/ or MyProject.xcodeproj/xcuserdata/ didn't work for me.