Xcode 4.5 Command Line Tools - xcode-select issue - xcode

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.

The new location seems to be (be sure to run as root):
sudo xcode-select -switch /Library/Developer/

Since your Xcode tools are installed in /usr/bin, you should
sudo xcode-select -switch /

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).

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.

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.

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).

Related

tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

This is very much a duplicate of xcode-select active developer directory error except none of those solutions worked for me.
$ sudo xcode-select --reset
$ sudo xcodebuild -license accept
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
$ sudo xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
I don't even have xcode on my machine.
The fix for me here was that my [ XCode > Preferences > Locations > Command Line Tools ] dropdown was empty. No idea why. But after clicking it and selecting the only available option my "active developer directory" error finally went away.
Mac Os 12.3.1 | Date: 5/4/22
I had this problem because Xcode was installed in my user application directory (~/Applications) instead of /Applications. From the Github link above figured out I needed to run:
sudo xcode-select -s ~/Applications/Xcode.app/Contents/Developer
(note the tilde). After this everything worked.
I had "xcode-select active developer directory error" too when installing Xcode beta. In your case you don't even need full Xcode, command line tools should work fine. Read this Github issue
This error completely contradicts that setting the path to /Library/Developer/CommandLineTools is the workaround for the latest XCode/MacOS combo failing to find the command line tool commands under /Application/Xcode.App/ with the default path setting.

Xcode installing on mac

I am new to mac and I want to install Xcode. I have macOS Sierra Version 10.12.2. I found online that I have to run in terminal:
xcode-select --install
I did that but I get this:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
However, I can't find it in Application folder or with Spotlight Search and there is no Software Update to be done. Also, I found online that I have to download it from App Store and I am a bit confused. I can install it from terminal (and if so, why is it not working) or I have to download it from App Store?
Thank you!
xcode-select: error: command line tools are already installed, use
"Software Update" to install updates
It shows that your operating system has already installed xcode-select.
Finding your xcode-select. Go to Terminal and type
xcode-select --print-path
It shall return the location of your xcode-select to you:
/Library/Developer/CommandLineTools
Xcode: develop an app for Apple products
xcode-select: command-line tool
Depending on what you want to do with Xcode, xcode-select is way smaller than it, 8.1GB vs. nothing.
2018 and I had the same issue. Installing XCODE from the App Store did not resolve this.
I Had to download the command line tools for my XCODE and Apple Version.
https://developer.apple.com/download/more/
Searched for XCODE on that page above and picked the right version for me.
After installation of the DMG I could continue with Brew Installation.
You don't install Xcode from terminal, you have to go to develloper.apple.com in order to download the latest versions. Here's the link to save you some time:
Link to Xcode
Plus the version available depends on what Mac Osx version you have.
Was having the same issue after some system update, cannot even run things like make install.
verify your path by xcode-select --print-path, which might be /Applications/Xcode.app/Contents/Developer(need to be updated at last)
go to apple develper site, login, search command line tools, download the latest dmg, install. (better option than the 10+GB Xcode)
now update the path in step 1 by running sudo xcode-select --switch /Library/Developer/CommandLineTools.
verify again by running the xcode-select --print-path.
Now it should be good to go.

installing qt on macOS Sierra [duplicate]

I just installed Qt 5.5 and am using Qt Creator for the first time on OS X. When I first installed Qt, it gave me an error message 'Xcode 5 not installed' which I thought was strange, (I have the Xcode 7 beta), but the install completed successfully anyways.
Now, when I start or open a project, I get the error:
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
When I run /usr/bin/xcodebuild in Terminal, I get the following:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
I'm not sure what Xcode has to do with Qt Creator, unless it has something to do with accessing libraries for cross-platform compatibility, but is there a way to fix this issue?
>= Xcode 8
In Xcode 8, as Bruce said, this happens when Qt tries to find xcrun when it should be looking for xcodebuild.
Open the file:
Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
Replace:
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))
With:
isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
~> Xcode 8
Before Xcode 8, this problem occurs when command line tools are installed after Xcode is installed. What happens is the Xcode-select developer directory gets pointed to /Library/Developer/CommandLineTools.
Point Xcode-select to the correct Xcode Developer directory with the command:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Confirm the license agreement with the command:
sudo xcodebuild -license
This will prompt you to read through the license agreement.
Enter agree to accept the terms.
If you change content of Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
then it will work only for Desktop kit, not for ex. simulator.
A better way is just to create symlink:
cd /Applications/Xcode.app/Contents/Developer/usr/bin/
sudo ln -s xcodebuild xcrun
so you don't have to change .prf files for all targets.
This will do the trick:
#sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Run this in your terminal.
For users of Xcode 8, there is another problem. See here for a temporary solution until Qt 5.7.1 is released:
https://forum.qt.io/topic/71119/project-error-xcode-not-set-up-properly
To summarise:
Open Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf in a text editor, and replace this:
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))))
with this:
isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
If you build Qt from source with XCode 8.x, you have to change the "-find" argument in the file qt-everywhere-enterprise-src-5.7.0/qtbase/configure on line 551 so that it looks like:
if ! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1; then
Managed to solve it installing the full version of Xcode, agreeing to the terms, then using xcode-select --reset.
Basically the problem is that the xcode you're pointing at /Library/Developer/CommandLineTools doesn't allow you to accept the terms & conditions. So after the install & resetting the location, all should be OK
For me, the only way to work correctly is to commenting the lines about xcrun with the '#':
# Make sure Xcode is set up properly
#isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))): \
#error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.")
At the file: Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
Just to add a bit to a lot of old answers in the spirit of "This worked for me"
I found that by launching Xcode, logging in to my developer account (just a free one) and then setting the Command tools in "Locations".
I could get the
'sudo /usr/bin/xcodebuild -license agree'
to work. i.e. it launched an agree process in the command line and I agreed after careful reading of all 14 squillion pages of stuff.
I did not have to edit anything.
My system is Mojave 10.14.6 and Xcode 10.3 (10G8).

Invalid active developer path error after upgrading to El Capitan

I ran into this error trying to push to git, when I typed git init.
xcrun: error: invalid active developer path
(/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun
I tried the following solutions.
xcode-select —install
sudo xcode-select -switch
sudo xcode-select —install
brew doctor
brew update
brew upgrade
brew cleanup
This is all you need to do:
$ xcode-select --install
You can select command line tools from the XCode Preferences shown in the screenshot below.
You will get a prompt for password.
1)
try typing in "xcode-select -print-path" and see if the path you see is the path you're expecting for your current Xcode version.
2)
If you go to:
https://developer.apple.com/downloads/
(you'll need to sign in with your Apple Developer account)
Once there, you'll see links for "Command Line Tools". It sounds like you need to install MacOS 10.11 Command Line Tools for Xcode 7.
Try:
sudo xcode-select -r
in this way it unsets any user-specified developer directory, so that the developer directory will be found via the default search mechanism.
If you have Catalina and Xcode 11 and you have this problem, then go to Xcode Preferences and select Location tab, check that the Command Line tool dropdown has Xcode 11.0 selected. If Xcode 11 is not there then you need to download and install Command-line tools for Xcode 11 here (choose the correct Beta)
https://developer.apple.com/download/more/?=command%20line%20tools

xcode-select: command not found despite

I am trying to get Xcode and the command line developer tools working in order to use MacPorts.
I have installed Xcode and Xcode command line developer tools.
But when I try to use xcode-select I get:
xcode-select
-bash: xcode-select: command not found
And MacPort thinks that XCode is not installed:
sudo port install texlive
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
My $PATHlooks like normal:
echo $PATH
/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
I can't find the xcode-select utility anywhere:
sudo find / -iname xcode-select
I have tried deleting and reinstalling XCode and the command line tools from scratch, with multiple reboots. No effect. My current system is OSX 10.9.5 and XCode 6.0.1.
Can anybody help please?
Thanks
If anybody encounters this issue:
xcode-select is now part of OS X, so if you don't have it the only solution I found is to backup everything and reinstall OS X.
See the help I received on Apple developer forum: https://devforums.apple.com/message/1050807#1050807

Resources