20

Xcode fails to open on my machine - OS X 10.8.2. It opens the main screen and just hangs there with the spinner spinning becoming unresponsive. If I double click a project, it just hangs sating it is loading.

I tried:

  1. Uninstalling and re-installing;
  2. Removing my project tree;
  3. Deleting some recommended preferences, most of which did not actually exist on my machine to begin with.

Things of note:

  1. This is a new computer. The first time I ran Xcode, it opened fine, though I didn't try using it. The problem appeared when I first opened an existing project.
  2. I created a new user on the machine. When that user is logged on Xcode loads successfully. Apparently it is a user settings issue.
1

11 Answers 11

39

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

4
  • This does not work with xcode 7+. See @adi-shavit answer.
    – Broonix
    Nov 17 '16 at 14:46
  • This worked for me. Thanks! Sep 8 '20 at 11:24
  • This does not work for me on Xcode 12.3 Feb 17 '21 at 9:14
  • Works for me perfectly, nothing other solutions don't work
    – dimazava
    Mar 26 '21 at 14:39
18

No need to reinstall Xcode.

Based on this: https://discussions.apple.com/thread/3830815

  1. I deleted all Xcode related "Unsaved Docs" docs found via the Finder search;
  2. I removed the ~/Library/Developer folder;
  3. Emptied the trash.

This worked for me.

6
  • 5
    rm -rf ~/Library/Developer/xcode worked for me. Thanks for the suggestion. Sep 26 '16 at 19:24
  • 4
    warning that this will remove all of your simulators and you will have to redownload all of them again if you clear ~/Library/Developer folder Aug 25 '19 at 22:12
  • Caveat: This is a pretty old q+a by now.
    – Adi Shavit
    Aug 26 '19 at 4:20
  • This is the goddamn solution.
    – Codetard
    Nov 24 '19 at 11:32
  • 1
    WARNING: ~/Library/Developer contains your code snippets, color themes, custom key bindings and other user preferences. Instead of completely removing the folder, I recommend moving it to another location. Sep 8 '20 at 11:37
7

I had a similar problem where xcode was hanging on opening one particular project. I wanted a very precise fix without having to remove all the settings. I deleted proj.xcodeproj/project.xcworkspace/xcuserdata/<user>.userdatad/UserInterfaceState.xcuserstate from the .xcodeproj folder and that solved the problem.

So if you are having Xcode hang while attempting to open one particular project, this is the file that you need to delete.

0
3

A slightly improved answer:

I didn't need to reinstall Xcode at all, just remove the 'unsaved documents':

Search in ~/Library for Xcode (by name) (to search, you go to this folder, enter Xcode, with the drop down choose "by name", and then click the "Library delete anything matching in ~/Library/Caches or "~/Library/Autosave Information" or that looks like it might be an unsaved documents

2

My problem was due to iCloud. All my projects were inside documents folder which is iCloud folder. Because iCloud settings in my MacBook was with the optimize option, the content of files weren’t allocated locally in the hard drive but remotely in iCloud. That was the cause for unresponsiveness of Xcode when loading the project or even starting new one. I moved all the projects to local folder in hard disk not included as a backup for iCloud and it solved the problem.

2
  • 1
    If you need to back up your project, try Git. ;)
    – koleS
    Mar 11 '21 at 14:01
  • All projects were also with git. Mar 12 '21 at 19:35
1

Deleting the latest file (GPUToolsAgent.sock ) in that Xcode directory solved it.

Eds-MBP-3:echo ed$ ls -artl ~/Library/Developer/Xcode/
total 0
drwxr-xr-x   2 ed  staff   64 Apr  2  2018 DocumentationCache
drwxr-xr-x   5 ed  staff  160 Feb 28 13:49 ..
drwxr-xr-x  17 ed  staff  544 Apr 19 20:39 iOS Device Logs
drwxr-xr-x   7 ed  staff  224 Apr 29 12:18 DerivedData
drwxr-xr-x   5 ed  staff  160 Apr 29 12:40 UserData
srwxr-xr-x   1 ed  staff    0 Apr 29 13:56 GPUToolsAgent.sock
drwxr-xr-x   7 ed  staff  224 Apr 29 13:56 .
Eds-MBP-3:echo ed$ rm -f ~/Library/Developer/Xcode/GPUToolsAgent.sock 
0

I tried all the solutions on here and none of them worked. However, I managed to fix this issue and here is what worked for me: If you're on an apple OS and have iCloud sync enabled on your desktop/documents/any folder where you're loading Xcode from, the iCloud sync could be causing this issue.

I installed a fresh copy of my RN native on a folder not synced by iCloud and subsequently the issue was resolved!

0

I couldn't figure out how to delete Unsaved Docs related to Xcode, so I resorted to wiping out the whole hard drive after backing up my projects to Bitbucket. It worked, but it obviously took a while. If you can figure out how to delete unsaved files related to Xcode, I'd recommend doing that first. If you can't figure out how to do that like me, or it doesn't work, wiping out your hard drive should work.

This problem was intolerable. It took away my ability to do my job so I needed to fix it and I knew this method would work.

0

This just happened to me when I updated an XCode Source Editor Extension.

Deleting that extension app from the Applications directory allowed XCode to start normally again.

0

I tried to delete:

~/Library/Developer/Caches/com.apple.dt.Xcode
~/Library/Developer/Xcode/DerivedData
~/Library/Developer/Saved Application State/com.apple.dt.Xcode.savedState
~/workspace/MyProject.xcodeproj/project.xcworkspace/xcuserdata

and once it helped. But another time it didn't help, so I also tried to reinstall Xcode, which also didn't help.

It turned out that the problem was that I was installing the app via WiFi or Bluetooth. When I connected my device via cable, the Xcode popped up to life and the "loading forever" stopped.

0

You can try to open another project if you have, and then open your current project


Or creating a new Swift file, then open it.
Then go back to open your current project.
That may work as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .