问题
A few days ago, when I would open my Xcode project and navigate to the storyboard, Xcode would hang and then ultimately not respond and then I would have to force quit. I looked up the issue and saw a suggestion to delete ~/Library/Developer folder...now the Xcode window doesn't even appear. The application just immediately crashes without opening.
Steps I've taken, in chronological order:
- Deleted and reinstalled Xcode > did not solve
- Upgraded from macOS Sierra to High Sierra > did not solve
- Tried both Xcode 9.1 and 9.2 beta > did not solve
- Reinstalled Command Line Tools > did not solve
Still nothing. I do have a 2011 MacBook Pro, and I'm wondering if it may just be an issue with my machine, or if it is indeed a result of losing ~/Library/Developer.
Any suggestions on how to recover necessary files or successfully open Xcode are appreciated.
回答1:
I had the same problem. In fact like you I also manually deleted the Developer folder (then I took a step further and like an idiot I also emptied the trash).
There is an easier way of fixing this problem than asking someone for their copy of PrivateFrameworks folder. You can just run XcodeSystemResources.pkg in order to setup PrivateFrameworks for you.
https://forums.developer.apple.com/thread/88570
I didn't reinstall the Xcode 9 but just ran the package /Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg. And the Xcode 9 started to work.
XcodeSystemResources.pkg is supposed to be installed on the initial launch of Xcode.app. Can you explain why that wasn't the case? Did you manually delete /Library/Developer/PrivateFrameworks/CoreSimulator.framework? If you delete that after the first launch, Xcode doesn't know to reinstall those packages for you.
来源:https://stackoverflow.com/questions/47086160/xcode-9-1-9-2-beta-immediately-crashes-on-launch