11

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.
  • For user settings look in ~/Library/Preferences and look for anything with Xcode in - try deleting them – mmmmmm Mar 19 '13 at 21:56
  • The irony - a developer tool hanging. You could always run sysdiagnose on Xcode and submit a bug report to Apple :) – bmike Mar 20 '13 at 4:15
  • @Mark, I tried that. No avail. – Adi Shavit Apr 4 '13 at 11:33
  • You need to unhidden files first then try this : stackoverflow.com/questions/19473231/… – user66483 Jan 5 '14 at 8:57
  • 1
    @bmike - Xcode is without any doubt the worse piece of software Apple ever wrote. Xcode was always bad but things escalated with Xcode 4. It is a shame that they continue to cram crap to the app instead of fixing errors that are there since Xcode 4. I need to hire someone to invent new profanities to me because I have used my repertoire. – Duck Sep 29 '14 at 22:44
27

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

| improve this answer | |
  • This does not work with xcode 7+. See @adi-shavit answer. – Broonix Nov 17 '16 at 14:46
16

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.

| improve this answer | |
  • 3
    rm -rf ~/Library/Developer/xcode worked for me. Thanks for the suggestion. – kandelvijaya Sep 26 '16 at 19:24
  • 1
    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 – Charlton Provatas 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
3

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.

| improve this answer | |
  • 1
    Already tried... but still not responding – Tahmid Rahman Oct 23 '17 at 11:28
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

| improve this answer | |
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.

| improve this answer | |
  • You are right. It's the same issue a colleague of mine had. She had iCloud Drive enabled on her Document and Desktop in her macOS Settings and was incredibly unresponsive. I bet she won't use it again! – pechar Oct 29 '19 at 10:48
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 
| improve this answer | |
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!

| improve this answer | |
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.

| improve this answer | |

You must log in to answer this question.

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