Xcode 4.5 Command Line Tools - xcode-select issue

扶醉桌前 提交于 2019-12-09 14:18:05

问题


After installing Xcode CLT 4.5.1 on OS X 10.8.2, I'm having issues installing native ruby gems which need to compiled.

The output error is the same as with running xcrun -find:

xcode-select: Error: No Xcode is selected. Use xcode-select -switch , or
see the xcode-select manpage (man xcode-select) for further information.

To which CLT location should xcode-select point to, since it's no longer at /Developer?

Edit: I don't have the Xcode app installed, only CLT.


回答1:


The new location seems to be (be sure to run as root):

sudo xcode-select -switch /Library/Developer/



回答2:


Since your Xcode tools are installed in /usr/bin, you should

sudo xcode-select -switch /



回答3:


With XCode 4.5 installed AND Command Line Tools installed, I had to use this to get MacPorts and other similar things (like Ruby Gems or Perl CPAN module installation) working:

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

I found that /Library/Developer did not work. Note that the Developer folder is not under /Library for me, it's under the app bundle file content folders.

I'm not sure why this is, but people googling this issue may come here and want to know the other commandline options that are commonly usable with xcode-select, thus this answer, even though it doesn't 100% apply to the original question (where command line tools are installed WITHOUT XCode).




回答4:


you probably want:

xcode-select -switch /Applications/Xcode.app

unless you have multiple installs. that is likely the location if you have one install (e.g. from the App Store). if you have multiple installs, you probably know which one you want.

you could also try updating this value from Xcode's Preferences > Locations > Command Line Tools popup.




回答5:


Open XCode and go to preferences.

Verify that there is an option under "Command Line Tools"

The error went away for me, as soon as I specified my Xcode command line tools version.




回答6:


I got further from @jbowes xcode-select -switch /Library/Developer/ answer, but then I hit this:

xcrun: Error: failed to exec real xcrun. (No such file or directory)

I came across this thread (OSX 10.8 xcrun (No such file or directory)) which references a Gist that solved my problem:

https://gist.github.com/thelibrarian/5520597

It's gross, but it seems to be the only way to solve the issue with just the Command Line Tools (i.e. not a full-blown XCode installation).



来源:https://stackoverflow.com/questions/12780858/xcode-4-5-command-line-tools-xcode-select-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!