Xcode stops working after set "xcode-select -switch"

IosXcodeMacos

Ios Problem Overview


OMG, what I've done?

Couple of days ago, I tried using macport to install something, because I'm using Xcode 4.3 and the command-line tool hadn't been installed by the time, macport wouldn't work. So I followed some guide to get command-line tool installed, then I used following command:

sudo xcode-select -switch /Applications/Xcode.app/

which I think screwed everything except macport: now, in Xcode, even a simple single-view iOS project won't be compiled, it says "UIKit/UIKit.h not found".

Does anyone know how to correct this? I don't want to re-install the gigantic Xcode again, gotta do some iOS project tonight, help!

Ios Solutions


Solution 1 - Ios

You should be pointing it towards the Developer directory, not the Xcode application bundle. Run this:

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

With recent versions of Xcode, you can go to XcodePreferences…Locations and pick one of the options for Command Line Tools to set the location.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionChris ChenView Question on Stackoverflow
Solution 1 - IosJimView Answer on Stackoverflow