I'm just installed xcode command line tools using command xcode-select --install.
Now every time I restart my computer and write to the terminal swift --version, I get the following warning.
I tried changing the xcode-select package using the xcode-select --switch ~ / Applications / Xcode.app command. It did not help. Even tried reinstalling Xcode Command Line Tools. It didn't help either. Always the same warning.
Can you please tell me what to do to avoid getting a Warning?
Computer: Apple MacBook Pro 13" M1 (2020)
OS: Big Sur 11.1
Screenshot
try a simple, documented step first
The solution may be as simple as sudo xcode-select -r
This command resolved the issue for me on an M1 machine, and avoided the risk of experimenting with random, undocumented ideas from strangers. Seems worth trying first.
documentation
% xcode-select -h
Usage: xcode-select [options]
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).
Options:
-h, --help print this help message and exit
[...]
-r, --reset reset to the default command line tools path
Related
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).
I've been searching the web to look for how to accept Xcode in order to use Xcode to recompile a MATLAB Windows file for a MAC but I did not find any relevant answer.
The error message I get in MATLAB is :
Xcode is installed, but its license has not been accepted. Run Xcode
and accept its license agreement.
I have accept its license through the terminal command sudo xcodebuild -license then -q then agree but I still get the same error message. I have also accepted the license when first opening the application.
Do someone know how to solve this problem?
Xcode : version 6.4 and Matlab R2015a
You can use the following command to directly accept the license:
sudo xcodebuild -license accept
If you are using the command line then go through the entire license by entering space until you get to the end where you will be presented with:
By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel]
type "agree" and return
Alternatively just launch Xcode by double clicking it's icon and when presented with the license agreement accept it.
Updated for new information:
It seems this may be a MATLAB issue. What version of Xcode are you running? Check with MATLAB to see if that is a supported version.
Simply type the sudo xcodebuild -license into the terminal after press q for quite
then type agree
Note: Xcode name should be Xocde not like that Xcode 8.2,etc.,
If you have only the Command Line Tools installed (and you don't want the full Xcode), none of the above works. From my saver here, run the following to trick mex into seeing an accepted license (no sudo needed).
Here I use the current version 13.0 at the time of writing, to be adapted.
defaults write com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense 13.0
You can also try enabling the command line tools, which should help prevent the license acceptance issue:
# Install Command Line Tools
xcode-select --install
# Enable command line tools
sudo xcode-select --switch /Library/Developer/CommandLineTools
Source: https://github.com/nodejs/node-gyp/issues/569
What worked for me was deleting the file: Library/Preferences/com.apple.dt.Xcode.plist and then running 'sudo xcodebuild -license accept' in the terminal.
The first Xcode Licence I agreed to was a beta license. Therefore somehow the entries in this file were still named ...beta... what seems to have caused the error. By running 'sudo xcodebuild -license accept' a new file is created that is compatible with Matlab (provided ur not using a beta Xcode Version).
I also downloaded the latest Version of the Command Line Tools but I don't know if that would have been necessary.
Hope I could help.
This is from 2021, using Mac Big Sur version 11.0.1 with Xcode-beta
My problem is that Macports install requires Agree to Xcode license in Terminal: sudo xcodebuild -license but that command returned only xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance.
I found a stack overflow issue that mentioned how to reset the xcode-select.
which in my case is sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer. Then I used sudo xcodebuild -license, scrolled through the license and accepted it. (Via the application, I never had an option to accept.)
the other stack flow issue that helped me is xcode-select active developer directory error
FYI - If you have installed the beta version at some point, deleted it, and then installed the regular version of Xcode, the license file will still be associated with beta version. This is what was happening to me, as I continued to get the warning about not having accepted the license. To fix this issue, you need to delete the Xcode license file and then run the above command in terminal.
Navigate to /Library/Preferences/
Delete the file com.app.dt.Xcode.plist
Then in terminal sudo xcodebuild -license accept
Then in Matlab mex -setup
This worked for me! Note that this method of deleting the plist file was provided to me by the folks at Mathworks support. There had been existing issues related to beta installs of Xcode.
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
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).
I'm trying to install Memcached on Mac using this tutorial:
http://tugdualgrall.blogspot.de/2011/11/installing-memcached-on-mac-os-x-and.html
but when I try ./configure
it says:
configure: error: no acceptable C compiler found in $PATH
when I try make it says:
make
sh: make: command not found
sh-3.2# yum install make
sh: yum: command not found
sh-3.2# apt-get install make
sh: apt-get: command not found
I must mention that I have Xcode but it's still not working.
I'm really new on Mac so please take that into consideration :)
I would really appreciate your help
Thanks!
If you have Xcode 4.3 or newer the command line tools, such as make, are not installed by default. In Xcode preferences go to the "Downloads" tab and under "Components" push the "Install" button next to "Command Line Tools". After you have successfully downloaded and installed the command line tools you should also type the following command in the Terminal to make sure all your Xcode command line tools are switched to use the 4.3 versions:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Once everything is successfully installed you should see make and other command line developer tools in /usr/bin.
From torrey.lyons's answer, in Xcode --> Preferences --> Downloads it says under Command Line Tools:
Before installing, note that from within Terminal you can use the
XCRUN tool to launch compilers and other tools embedded within the
Xcode application. Use the XCODE-SELECT tool to define which version
of Xcode is active. Type "man xcrun" from within Terminal to find out
more.
Therefore, I was able to run the make tool with the command xcrun make.
Things have changed in Mac OS 11 (Big Sur). There is now a command line tools package. Search for "Command Line Tools for Xcode 12.5.1" (or newer) on Apple's Developer Network.