Bernhard Miehl
Bernhard Miehl

Reputation: 366

Xcode crashes on launch

I am developing an Application for iOS and I changed nothing in the Application. But at a restart of my Mac, Xcode crashes every time.

Don't know if this is important, but my spotlight can't find any applications and also when I open the finder and using the shortcut cmd + shift + H I see a white window.

Xcode isn't starting anymore and throws this error:

Process:               Xcode [1346]
Path:                  /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               7.2 (9548)
Build Info:            IDEFrameworks-9548000000000000~7
App Item ID:           497799835
App External ID:       814662604
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Xcode [1346]

Date/Time:             2015-12-24 11:01:44.753 +0100
OS Version:            Mac OS X 10.11.2 (15C50)
Report Version:        11


Time Awake Since Boot: 4000 seconds

System Integrity Protection: enabled

Crashed Thread:        4  Dispatch queue: DVTFilePathEventWatcher - event queue

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0:
--> 
    __TEXT                 0000000108a5a000-0000000108a5e000 [   16K] r-x/rwx SM=COW  /Applications/Xcode.app/Contents/MacOS/Xcode

Application Specific Information:
ProductBuildVersion: 7C68

Thread 0:: Dispatch queue: DVTFilePath cache derivation lock for key DVTFilePathKey_SortedDirectoryContents
0   libobjc.A.dylib                 0x00007fff8df27aa0 search_method_list(method_list_t const*, objc_selector*) + 2
1   libobjc.A.dylib                 0x00007fff8df28d76 lookUpImpOrForward + 413
2   libobjc.A.dylib                 0x00007fff8df22591 objc_msgSend + 209
3   com.apple.dt.DVTFoundation      0x0000000108a741f8 -[DVTFileSystemVNode addCachedEntriesFromDictionary:] + 215
4   com.apple.dt.DVTFoundation      0x0000000108bd2e2d __33-[DVTFilePath cachedValueForKey:]_block_invoke549 + 245
5   libdispatch.dylib               0x00007fff9fcbd33f _dispatch_client_callout + 8
6   libdispatch.dylib               0x00007fff9fcbe926 _dispatch_barrier_sync_f_invoke + 74
7   com.apple.dt.DVTFoundation      0x0000000108cd1005 DVTDispatchBarrierSync + 62
8   com.apple.dt.DVTFoundation      0x0000000108a69627 -[DVTDispatchLock performLockedBlock:] + 116
9   com.apple.dt.DVTFoundation      0x0000000108a715b0 -[DVTFilePath cachedValueForKey:] + 1802
10  com.apple.dt.DVTFoundation      0x0000000108a70afc -[DVTToolchainRegistry scanSearchPathAndRegisterToolchains:] + 563
11  com.apple.dt.IDEFoundation      0x00000001097d1a66 IDEInitialize + 655
12  com.apple.dt.IDEKit             0x0000000109ecdf7c -[IDEApplicationController applicationWillFinishLaunching:] + 708
13  com.apple.CoreFoundation        0x00007fffa18fa70c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
14  com.apple.CoreFoundation        0x00007fffa18fa67f ___CFXRegistrationPost_block_invoke + 63
15  com.apple.CoreFoundation        0x00007fffa18f9d47 _CFXRegistrationPost + 407
16  com.apple.CoreFoundation        0x00007fffa18f9ab2 ___CFXNotificationPost_block_invoke + 50
17  com.apple.CoreFoundation        0x00007fffa18f3d42 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1922
18  com.apple.CoreFoundation        0x00007fffa17e2145 _CFXNotificationPost + 693
19  com.apple.Foundation            0x00007fff9ef36921 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
20  com.apple.dt.DVTFoundation      0x0000000108c6cf55 -[NSNotificationCenter(DVTNSNotificationCenterAdditions) _dvt_postNotificationName:object:userInfo:] + 698
21  com.apple.AppKit                0x00007fff9db412c2 -[NSApplication finishLaunching] + 354
22  com.apple.dt.DVTKit             0x0000000109275f62 -[DVTApplication finishLaunching] + 149
23  com.apple.AppKit                0x00007fff9db40e05 -[NSApplication run] + 231
24  com.apple.AppKit                0x00007fff9dac3520 NSApplicationMain + 1176
25  libdyld.dylib                   0x00007fff9a8605ad start + 1

Could this be an issue due to Permissions conflicts?

ANSWER:

After I changed the rights from my OSX-Drive to everyone can write&read. Everything worked. But I knew that this is a temporary solution, so I decided to reinstall my MAC and everything was fine.

Upvotes: 16

Views: 12461

Answers (5)

Mykel
Mykel

Reputation: 1774

Ensure there are no issues with your SPM packages/dependencies.

This is simply another suggestion. I just spent some time debugging this on a fairly popular open source project.

My Xcode first crashed when I updated a SPM package, so I was fairly certain it was an issue with one of the future commits in that package or a SPM bug. I subscribe to Occam's Razor, so I started going through the changes in the commits.

After some time, I found a duplicate Swift Playground page delcaration in contents.xcplayground. I removed that single line, pushed the PR, and everything worked fine after that.

To be able to reopen the project:

  1. Open project.pbxproj in your code editor of choice (e.g. vi, nano, emacs, atom, code).
  2. Remove the offending package or packages from the /* Begin XCRemoteSwiftPackageReference section */ and /* Begin XCSwiftPackageProductDependency section */ sections.
  3. Save the file and Xcode should now open.

Again, if your Xcode is immediately crashing when opening a project (and you last updated/auto-updated a SPM package) go through your packages.

Upvotes: 0

chawki
chawki

Reputation: 887

If the delete of ~/Library/Developer/Xcode/DerivedData is not working for you, try this steps to remove xcuserdata:

  • open a Finder window and navigate to your project
  • right-click on the .xcodeproj OR .xcworkspace file
  • select Show Package Contents
  • a new window appears
  • delete a folder called xcuserdata

Upvotes: 32

Sunil Targe
Sunil Targe

Reputation: 7459

I'll recommend deleting xcuserdata: folder from both of your .xcodeproj & .xcworkspace file (open with Show Package Contents) and try again.

I hope this will work.

Upvotes: 1

yeahdixon
yeahdixon

Reputation: 6934

I had one where i selected a file that was quite large which crashed xcode when it tried to parse it. Then when i restarted it somehow it got set to load that file on start. Only way i saw was to temporarily rename the file that it was trying to load at start so it would load empty.

Upvotes: 1

Jeremie D
Jeremie D

Reputation: 4204

Delete ~/Library/Developer/Xcode/DerivedData by running this command in terminal:

rm -r ~/Library/Developer/XCode/DerivedData

If that doesnt work, At this point and with given info, all I could recommend to delete and reinstall Xcode.

Upvotes: 33

Related Questions