Xcode stops working after set "xcode-select -switch"
Asked Answered
C

1

117

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!

Communism answered 7/3, 2012 at 11:29 Comment(0)
M
327

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.

Mcgehee answered 7/3, 2012 at 11:32 Comment(7)
ON running the above command i get error : xcode-select: Error: Path "/Applications/Xcode.app/Contents/Developer" is not a directoryDerzon
@VikasSingh Even i am getting the same error. Were you able to solve itVulnerary
@VikasSingh + abhishek the path will differ based on where you have xcode installed. For example if your xcode is called "Xcode 5.0.app" then the path would be: /Applications/Xcode\ 5.0.app/Contents/DeveloperLemon
With recent versions of Xcode, go to Xcode > Preferences… > Locations and pick one of the options for Command Line Tools to set the location.Mcgehee
@jim, maybe updating the answer with your last comment would be useful?Feathers
What hierarchical structure of the folder should be to fullfill the need of xcode-select?Yolandayolande
With Xcode 14 you have to run Xcode at least once and only then will the cli tools work (if the Xcode path is selected of course).Commentative

© 2022 - 2024 — McMap. All rights reserved.