Related
Saw the following error when running an npm install which required node-gyp... but could be triggered by anything which requires xcode-select.
xcode-select: error: tool 'xcodebuild' requires Xcode, but active
developer directory '/Library/Developer/CommandLineTools' is a command
line tools instance
What is the problem?
This problem happens when xcode-select developer directory was pointing to /Library/Developer/CommandLineTools when a full regular Xcode was required (happens when CommandLineTools are installed after Xcode)
Solution:
Install Xcode (get it from https://appstore.com/mac/apple/xcode) if you don't have it yet.
Accept the Terms and Conditions.
Ensure Xcode app is in the /Applications directory (NOT /Users/{user}/Applications).
Point xcode-select to the Xcode app Developer directory using the following command:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Note: Make sure your Xcode app path is correct.
Xcode: /Applications/Xcode.app/Contents/Developer
Xcode-beta: /Applications/Xcode-beta.app/Contents/Developer
Other solution for those who don't want to install Xcode:
Install Command Line Tools (if you haven't already):
xcode-select --install
Change the active directory:
sudo xcode-select -switch /Library/Developer/CommandLineTools
This worked for me (git).
I was having an issue while trying to install packages using npm.
I got the error: "sudo xcode-select -s /Applications//Xcode.app/Contents/Developer/"
To fix this
I opened Xcode.
Preferences
Locations
Selected the Command Lin Tools: Xcode 6.1.1
Now when installing packages with npm I no longer get errors.
Xcode > Preferences > Locations > Command Line Tools
Select the option matching your version of Xcode.
Simply run sudo xcode-select -r which should automatically reset the path.
-r, --reset
Unsets any user-specified developer directory, so that the developer directory will be found via the default search mechanism. This command must be
run with superuser permissions (see sudo(8)), and will affect all users on the system.
I just ran the following command and the issue was resolved for me:
sudo xcode-select --reset
Type this in your terminal
xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
if you installed XCode already, All you have to do is to...
Open XCode
Go To Xcode > Preferences > Locations
From the Command Line Tools Select your XCode
Just in case you're using xcode beta:
sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer
I had to run this first
sudo xcode-select --reset
then
sudo xcode-select -switch /Library/Developer/CommandLineTools
and then it worked.
Download Xcode from App Store.
Go to Xcode preferences/Locations/CommandlineTools
You just have to set it to the Xcode version. It automatically points to '/Application/Xcode.app'
I was having the same problem in high sierra.
running the following command solved it
npm explore npm -g -- npm install node-gyp#latest
Please follow the steps below :
The latest version of Xcode can be downloaded from https://developer.apple.com/xcode/download/
It will be downloaded in the 'Downloads' unless specified otherwise. Please make sure to check the path where you have downloaded and extracted the Xcode
Now unlike other downloaded applications, on extraction, Xcode doesn't give the option to move it to Applications
Note the XCODE-ACTUAL-LOCATION or move it to the Applications
Note if you have downloaded Xcode or Xcode-beta
Based on 4 and 5, execute one of the commands (Do not execute all of them without reading above description):
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
sudo xcode-select -s /[XCODE-ACTUAL-LOCATION]/Xcode.app/Contents/Developer
sudo xcode-select -s /[XCODE-ACTUAL-LOCATION]/Xcode-beta.app/Contents/Developer
Install Xcode from App Store. After installing run xcodebuild with root privileges i.e. sudo xcodebuild and accept the language. After this npm install bcrypt worked like a charm!
Without Xcode: create file /usr/local/bin/xcodebuild with content to cheat XcodeSelect
#!/bin/bash
exit 0
chmod +x /usr/local/bin/xcodebuild
Simple reinstall xcode-select
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
In case you are using Xcode beta, run
sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
instead of
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
I was able to solve this error without installing the full Xcode application. You must, however, have xcode command line tools installed.
From here:
$ cd /usr/bin
$ sudo mv xcodebuild xcodebuild.orig (A backup just in case)
$ vim xcodebuild
Paste the following:
#!/bin/bash
if [[ $1 == '-version' ]]; then
echo "Xcode 10.2.1"
echo "Build version 10E1001"
else
/usr/bin/xcodebuild.bak $#
fi
$ sudo chmod +x xcodebuild
XCode2:
sudo xcode-select -s /Applications/Xcode\ 2.app/Contents/Developer
Pay attention to the "\" to escape the space
I had two instance of Xcode installed xcode.app and xcode-beta.app
When I tried to create a build with netbeans it showed me the error
"supported version of xcode and command line tools not found netbeans"
I followed the following steps:
"xcode-select --print-path" is equal to "/Applications/Xcode.app/Contents/Developer"
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform" exists
"xcodebuild -version" starts with "Xcode"
after 1 I found that it is pointing me to xcode-beta.app
so here is the solution which worked like a charm:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
For context, today is Jan 28, 2019.
On my Mac, I did two things to resolve this problem:
Run the following command in your terminal:
sudo xcode-select --install
Restart your Mac.
Until I restarted the computer, the problem kept occurring in my Android Studio. After reboot, it was working just fine. Also note that I did not execute any --switch commands as others are doing. I hope this helps.
Manually installing Command LineTool worked for me.
I stalled xcode through App Store
Still could not download Homebrew
I installed Command Line Tool manually through link.
Bing Bang Boom
https://developer.apple.com/download/more/?=command%20line%20tools
sudo xcode-select -s /Applications/Xcode 10.app/Contents/Developer
languoguangs-iMac:/ languoguang$ sudo xcode-select -s /Applications/Xcode 10.app/Contents/Developer
xcode-select: error: invalid argument '10.app/Contents/Developer'
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
-p, --print-path print the path of the active developer directory
-s <path>, --switch <path> set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, --reset reset to the default command line tools path
languoguangs-iMac:/ languoguang$ sudo xcode-select -s "/Applications/Xcode 10.app/Contents/Developer"
because my Xcode name in Application is "Xcode 10",
sudo xcode-select -s "/Applications/Xcode 10.app/Contents/Developer"
works.
In my case,
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
didn't work because my Xcode had some special name. eg) Xcode_11.2.0_beta_2_stackoverflow.app
cd /applications
ls
Then I found my Xcode name, then replace it with
sudo xcode-select -s /Applications/{myXcodeName}.app/Contents/Developer
It worked for me.
None of the above worked for me. I originally installed Command Line Tools separately, and then all of Xcode. What worked for me was to uninstall Command Line Tools as shown here. Then, when trying to run xcode-select again, I was asked to reinstall them.
*By the way, the very reason why I found this thread was because I had installed some libraries (particularly gcc) with macports, presumably using the old Command Line Tools, and then I installed the full Xcode midway into development. So anyways, for my case, I had to reinstall macports after removing the stand-alone Command Line Tools, reinstalling them, reinstalling gcc, and then my compilation worked.
There are only two steps required, and the full XCode.app is not required at all:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
At this point the "Installing Softwre" dialog pops up:
That's it!
None of the above solutions helped me. I was working on an old project, and I had the latest version of NodeJs installed globally (v14.x) on my computer.
No node version above 10.1.x worked for me and when testing I received the same error as above.
Solution
I installed "n" which is a nodeJs version manager like nvm
I downgraded my nodeJs version to 9.x
npm install now works.
I will now need to update my versions, or Specify my node version in my package.json.
The simple fix that worked for me is drag and drop Xcode.app from the current location (In my case it was in downloads) to Applications.
Saw the following error when running an npm install which required node-gyp... but could be triggered by anything which requires xcode-select.
xcode-select: error: tool 'xcodebuild' requires Xcode, but active
developer directory '/Library/Developer/CommandLineTools' is a command
line tools instance
What is the problem?
This problem happens when xcode-select developer directory was pointing to /Library/Developer/CommandLineTools when a full regular Xcode was required (happens when CommandLineTools are installed after Xcode)
Solution:
Install Xcode (get it from https://appstore.com/mac/apple/xcode) if you don't have it yet.
Accept the Terms and Conditions.
Ensure Xcode app is in the /Applications directory (NOT /Users/{user}/Applications).
Point xcode-select to the Xcode app Developer directory using the following command:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Note: Make sure your Xcode app path is correct.
Xcode: /Applications/Xcode.app/Contents/Developer
Xcode-beta: /Applications/Xcode-beta.app/Contents/Developer
I was having an issue while trying to install packages using npm.
I got the error: "sudo xcode-select -s /Applications//Xcode.app/Contents/Developer/"
To fix this
I opened Xcode.
Preferences
Locations
Selected the Command Lin Tools: Xcode 6.1.1
Now when installing packages with npm I no longer get errors.
Other solution for those who don't want to install Xcode:
Install Command Line Tools (if you haven't already):
xcode-select --install
Change the active directory:
sudo xcode-select -switch /Library/Developer/CommandLineTools
This worked for me (git).
Xcode > Preferences > Locations > Command Line Tools
Select the option matching your version of Xcode.
Simply run sudo xcode-select -r which should automatically reset the path.
-r, --reset
Unsets any user-specified developer directory, so that the developer directory will be found via the default search mechanism. This command must be
run with superuser permissions (see sudo(8)), and will affect all users on the system.
I just ran the following command and the issue was resolved for me:
sudo xcode-select --reset
Type this in your terminal
xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
if you installed XCode already, All you have to do is to...
Open XCode
Go To Xcode > Preferences > Locations
From the Command Line Tools Select your XCode
Just in case you're using xcode beta:
sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer
I had to run this first
sudo xcode-select --reset
then
sudo xcode-select -switch /Library/Developer/CommandLineTools
and then it worked.
Download Xcode from App Store.
Go to Xcode preferences/Locations/CommandlineTools
You just have to set it to the Xcode version. It automatically points to '/Application/Xcode.app'
I was having the same problem in high sierra.
running the following command solved it
npm explore npm -g -- npm install node-gyp#latest
Please follow the steps below :
The latest version of Xcode can be downloaded from https://developer.apple.com/xcode/download/
It will be downloaded in the 'Downloads' unless specified otherwise. Please make sure to check the path where you have downloaded and extracted the Xcode
Now unlike other downloaded applications, on extraction, Xcode doesn't give the option to move it to Applications
Note the XCODE-ACTUAL-LOCATION or move it to the Applications
Note if you have downloaded Xcode or Xcode-beta
Based on 4 and 5, execute one of the commands (Do not execute all of them without reading above description):
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
sudo xcode-select -s /[XCODE-ACTUAL-LOCATION]/Xcode.app/Contents/Developer
sudo xcode-select -s /[XCODE-ACTUAL-LOCATION]/Xcode-beta.app/Contents/Developer
Install Xcode from App Store. After installing run xcodebuild with root privileges i.e. sudo xcodebuild and accept the language. After this npm install bcrypt worked like a charm!
Without Xcode: create file /usr/local/bin/xcodebuild with content to cheat XcodeSelect
#!/bin/bash
exit 0
chmod +x /usr/local/bin/xcodebuild
Simple reinstall xcode-select
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
In case you are using Xcode beta, run
sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
instead of
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
I was able to solve this error without installing the full Xcode application. You must, however, have xcode command line tools installed.
From here:
$ cd /usr/bin
$ sudo mv xcodebuild xcodebuild.orig (A backup just in case)
$ vim xcodebuild
Paste the following:
#!/bin/bash
if [[ $1 == '-version' ]]; then
echo "Xcode 10.2.1"
echo "Build version 10E1001"
else
/usr/bin/xcodebuild.bak $#
fi
$ sudo chmod +x xcodebuild
XCode2:
sudo xcode-select -s /Applications/Xcode\ 2.app/Contents/Developer
Pay attention to the "\" to escape the space
I had two instance of Xcode installed xcode.app and xcode-beta.app
When I tried to create a build with netbeans it showed me the error
"supported version of xcode and command line tools not found netbeans"
I followed the following steps:
"xcode-select --print-path" is equal to "/Applications/Xcode.app/Contents/Developer"
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform" exists
"xcodebuild -version" starts with "Xcode"
after 1 I found that it is pointing me to xcode-beta.app
so here is the solution which worked like a charm:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
For context, today is Jan 28, 2019.
On my Mac, I did two things to resolve this problem:
Run the following command in your terminal:
sudo xcode-select --install
Restart your Mac.
Until I restarted the computer, the problem kept occurring in my Android Studio. After reboot, it was working just fine. Also note that I did not execute any --switch commands as others are doing. I hope this helps.
Manually installing Command LineTool worked for me.
I stalled xcode through App Store
Still could not download Homebrew
I installed Command Line Tool manually through link.
Bing Bang Boom
https://developer.apple.com/download/more/?=command%20line%20tools
sudo xcode-select -s /Applications/Xcode 10.app/Contents/Developer
languoguangs-iMac:/ languoguang$ sudo xcode-select -s /Applications/Xcode 10.app/Contents/Developer
xcode-select: error: invalid argument '10.app/Contents/Developer'
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
-p, --print-path print the path of the active developer directory
-s <path>, --switch <path> set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, --reset reset to the default command line tools path
languoguangs-iMac:/ languoguang$ sudo xcode-select -s "/Applications/Xcode 10.app/Contents/Developer"
because my Xcode name in Application is "Xcode 10",
sudo xcode-select -s "/Applications/Xcode 10.app/Contents/Developer"
works.
In my case,
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
didn't work because my Xcode had some special name. eg) Xcode_11.2.0_beta_2_stackoverflow.app
cd /applications
ls
Then I found my Xcode name, then replace it with
sudo xcode-select -s /Applications/{myXcodeName}.app/Contents/Developer
It worked for me.
None of the above worked for me. I originally installed Command Line Tools separately, and then all of Xcode. What worked for me was to uninstall Command Line Tools as shown here. Then, when trying to run xcode-select again, I was asked to reinstall them.
*By the way, the very reason why I found this thread was because I had installed some libraries (particularly gcc) with macports, presumably using the old Command Line Tools, and then I installed the full Xcode midway into development. So anyways, for my case, I had to reinstall macports after removing the stand-alone Command Line Tools, reinstalling them, reinstalling gcc, and then my compilation worked.
There are only two steps required, and the full XCode.app is not required at all:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
At this point the "Installing Softwre" dialog pops up:
That's it!
None of the above solutions helped me. I was working on an old project, and I had the latest version of NodeJs installed globally (v14.x) on my computer.
No node version above 10.1.x worked for me and when testing I received the same error as above.
Solution
I installed "n" which is a nodeJs version manager like nvm
I downgraded my nodeJs version to 9.x
npm install now works.
I will now need to update my versions, or Specify my node version in my package.json.
The simple fix that worked for me is drag and drop Xcode.app from the current location (In my case it was in downloads) to Applications.
I am trying to update Xcode from the command line. Initially I tried running:
xcode-select --install
which resulted in this message:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
So the question remains, is there a way to update Xcode from the command line?
What you are actually using is the command to install the Xcode command line tools - xcode-select --install. Hence the error message you got - the tools are already installed.
The command you need to update Xcode is softwareupdate command [args ...]. You can use softwareupdate --list to see what's available and then softwareupdate --install -a to install all updates or softwareupdate --install <product name> to install just the Xcode update (if available). You can get the name from the list command.
As it was mentioned in the comments here is the man page for the softwareupdate tool.
2019 Update
A lot of users are experiencing problems where softwareupdate --install -a will in fact not update to the newest version of Xcode. The cause for this is more than likely a pending macOS update (as #brianlmerritt pointed out below). In most cases updating macOS first will solve the problem and allow Xcode to be updated as well.
Updating the Xcode Command Line Tools
A large portion of users are landing on this answer in an attempt to update the Xcode Command Line Tools. The easiest way to achieve this is by removing the old version of the tools, and installing the new one.
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
A popup will appear and guide you through the rest of the process.
I had the same issue and I solved by doing the following:
removing the old tools ($ sudo rm -rf /Library/Developer/CommandLineTools)
install xcode command line tools again ($ xcode-select --install).
After these steps you will see a pop to install the new version of the tools.
I encountered the same issue when I uninstalled the complete version of Xcode to reinstall the CLI version. My fix was:
sudo xcode-select -s /Library/Developer/CommandLineTools
After installing Command Line Tools (with xcode-select --install), type:
sudo xcode-select --switch /Library/Developer/CommandLineTools/
You should be able to run git now:
10:29 $ git --version
git version 2.17.2 (Apple Git-113)
I got this error after deleting Xcode. I fixed it by resetting the command line tools path with sudo xcode-select -r.
Before:
navin#Radiant ~$ /usr/bin/clang
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.
navin#Radiant ~$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
After:
navin#Radiant ~$ /usr/bin/clang
clang: error: no input files
Just type the commands
cd /Library/Developer/CommandLineTools/Packages/;
open macOS_SDK_headers_for_macOS_10.14.pkg
Reference: https://forums.developer.apple.com/thread/104296
$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
I was facing the same problem, resolved it by using the following command.
sudo xcode-select -s /Library/Developer/CommandLineTools
After running the above command then xcode-select -p command showed the following.
/Library/Developer/CommandLineTools
#Vel Genov's answer is correct, except when the version of Xcode can't be updated because it is the latest version for your current version of Mac OS. If you know there is a newer Xcode (for example, it won't load an app onto a device with a recent version of iOS) then it's necessary to first upgrade Mac OS.
Further note for those like me with old Mac Pro 5.1. Upgrading to Mojave required installing the metal gpu (Sapphire AMD Radeon RX 560 in my case) but make sure only HDMI monitor is installed (not 4K! 1080 only). Only then did install Mojave say firmware update required and shut computer down. Long 2 minute power button hold and it all upgraded fine after that!
Catalina update - softwareupdate --install -a won't upgrade xcode from command line if there is a pending update (say you selected update xcode overnight)
I am not sure why this was so tricky for me.
sudo xcode-select --install
Did nothing for me.
softwareupdate --all --install --force
Did nothing for me.
I had to do things in the following order
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
This installed a newer xcode, but not latest.
Then I did
softwareupdate --all --install --force
and they updated completely.
Xcode::Install is a simple cli software that allow you to install/select a specific Xcode version.
You can install it using gem install xcode-install
Then you will be able to install a specific version with xcversion install 9.4.1
And if you have more than one version installed, you can switch version with xcversion select 9.4
You can find more information at https://github.com/KrauseFx/xcode-install
I am now running OS Big Sur. xcode-select --install, and sudo xcode-select --reset did not resolve my issue, neither did the recommended subsequent softwareupdate --install -a command. For good measure, I tried the recommended download from Apple Downloads, but the Command Line Tools downloads available there are not compatible with my OS.
I upvoted the fix that resolved for me, sudo xcode-select --switch /Library/Developer/CommandLineTools/ and added this post for environment context.
I was able to update via CLI using:
softwareupdate --list --verbose
and then
softwareupdate -i Command\ Line\ Tools\ for\ Xcode-13.2
I was trying to use the React-Native Expo app with create-react-native-app but for some reason it would launch my simulator and just hang without loading the app. The above answer by ipinak above reset the Xcode CLI tools because attempting to update to most recent Xcode CLI was not working. the two commands are:
rm -rf /Library/Developer/CommandLineTools
xcode-select --install
This process take time because of the download.
I am leaving this here for any other would be searches for this specific React-Native Expo fix.
I was faced with this today after an update from Xcode (App Store on Mac) updated my Xcode.
My SourceTree wouldn't allow me to do a merge conflict.
In Xcode I found that Command Tools was NOT selected.
I selected it, however still no dice as I was getting the same message of:
I performed the command:
softwareupdate --list
which gave me a list of products, including THREE (3) versions of CommandLine Tools
Software Update Tool
Finding available software
Software Update found the following new or updated software:
Label: Command Line Tools for Xcode-13.2
Title: Command Line Tools for Xcode, Version: 13.2, Size: 577329K, Recommended: YES,
Label: SFSymbolsAuto-3.3
Title: SF Symbols, Version: 3.3, Size: 169368K, Recommended: YES,
Label: Command Line Tools for Xcode-13.3
Title: Command Line Tools for Xcode, Version: 13.3, Size: 718145K, Recommended: YES,
Label: Command Line Tools for Xcode-13.4
Title: Command Line Tools for Xcode, Version: 13.4, Size: 705462K, Recommended: YES,
my version of Xcode is 13.4, so I preceded to try to update just the one.
I used the Label, with escaped spaces (which also works with just quoted label btw "Command Line Tools for Xcode-13.4"
softwareupdate -i Command\ Line\ Tools\ for\ Xcode-13.4
In doing so, ALL 3 updates of Command Line Tools disappeared and I was able to continue.
Hope this helps someone else out there.
Hello I solved it like this:
Install Application> Xcode.app> Contents> Resources> Packages> XcodeSystemResources.pkg.
I arrived here trying to install Appium. Adding my answer in case other folks land here for the same issue.
appium-doctor --ios
... bunch of stuff...
WARN AppiumDoctor ✖ Error running xcrun simctl
... bunch of stuff...
info AppiumDoctor ### Manual Fixes Needed ###
info AppiumDoctor The configuration cannot be automatically fixed, please do the
following first:
WARN AppiumDoctor ➜ Manually install Xcode, and make sure 'xcode-select -p' command shows proper path like '/Applications/Xcode.app/Contents/Developer'
In my case
xcode-select -p
/Library/Developer/CommandLineTools
which appeared wrong...but I knew I had recently updated Xcode and the command line tools
so...
sudo xcode-select -r (sudo required)
then...
xcode-select -p
/Applications/Xcode.app/Contents/Developer
After this, no warning. Appium-doctor returned clean.
xCode version 11.2.1 is necessary for building app in iPad 13.2.3, When I directly try to upgrade from xcode 11.1 to 11.2.1 through App Store it get struck, So after some research , I found a solution to upgrade by removing the existing xcode from the system
So here I am adding the steps to upgrade after uninstalling existing xcode.
Go to Applications and identify Xcode and drag it to trash.
Empty trash to permenently delete Xcode.
Now go to ~/Library/Developer/ folder and remove the contents completely Use sudo rm -rf ~/Library/Developer/ to avoid any
permission issue while deleting
Lastly remove any cache directory associated with xcode in the path ~/Library/Caches/com.apple.dt.Xcode sudo rm -rf
~/Library/Caches/com.apple.dt.Xcode/*
After completing the above steps you can easly install xcode from App Store, which will install the current latest version of xcode
Note: Please take a backup of your existing projects before making the above changes
Update with this one-liner.
softwareupdate --install -a
This reminds me why I hate MacOS. Every time I tried one of these errors I would get the incomprehensible error: No install could be requested (perhaps no UI is present)
Turns out this "CLI" actually needs a graphical session to run. WTF! Very useful when you're actually only ever connecting to the remote mac server over SSH to queue iOS builds.
So the answer for me was:
Physically travel to the Mac, attach screen, mouse and keyboard, and run the command there.
To those having this issue after update to Catalina, just execute this command on your terminal
sudo rm -rf /Library/Developer/CommandLineTools; xcode-select --install;
Saw the following error when running an npm install which required node-gyp... but could be triggered by anything which requires xcode-select.
xcode-select: error: tool 'xcodebuild' requires Xcode, but active
developer directory '/Library/Developer/CommandLineTools' is a command
line tools instance
What is the problem?
This problem happens when xcode-select developer directory was pointing to /Library/Developer/CommandLineTools when a full regular Xcode was required (happens when CommandLineTools are installed after Xcode)
Solution:
Install Xcode (get it from https://appstore.com/mac/apple/xcode) if you don't have it yet.
Accept the Terms and Conditions.
Ensure Xcode app is in the /Applications directory (NOT /Users/{user}/Applications).
Point xcode-select to the Xcode app Developer directory using the following command:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Note: Make sure your Xcode app path is correct.
Xcode: /Applications/Xcode.app/Contents/Developer
Xcode-beta: /Applications/Xcode-beta.app/Contents/Developer
I was having an issue while trying to install packages using npm.
I got the error: "sudo xcode-select -s /Applications//Xcode.app/Contents/Developer/"
To fix this
I opened Xcode.
Preferences
Locations
Selected the Command Lin Tools: Xcode 6.1.1
Now when installing packages with npm I no longer get errors.
Other solution for those who don't want to install Xcode:
Install Command Line Tools (if you haven't already):
xcode-select --install
Change the active directory:
sudo xcode-select -switch /Library/Developer/CommandLineTools
This worked for me (git).
Xcode > Preferences > Locations > Command Line Tools
Select the option matching your version of Xcode.
Simply run sudo xcode-select -r which should automatically reset the path.
-r, --reset
Unsets any user-specified developer directory, so that the developer directory will be found via the default search mechanism. This command must be
run with superuser permissions (see sudo(8)), and will affect all users on the system.
I just ran the following command and the issue was resolved for me:
sudo xcode-select --reset
Type this in your terminal
xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
if you installed XCode already, All you have to do is to...
Open XCode
Go To Xcode > Preferences > Locations
From the Command Line Tools Select your XCode
Just in case you're using xcode beta:
sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer
I had to run this first
sudo xcode-select --reset
then
sudo xcode-select -switch /Library/Developer/CommandLineTools
and then it worked.
Download Xcode from App Store.
Go to Xcode preferences/Locations/CommandlineTools
You just have to set it to the Xcode version. It automatically points to '/Application/Xcode.app'
I was having the same problem in high sierra.
running the following command solved it
npm explore npm -g -- npm install node-gyp#latest
Simple reinstall xcode-select
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
Please follow the steps below :
The latest version of Xcode can be downloaded from https://developer.apple.com/xcode/download/
It will be downloaded in the 'Downloads' unless specified otherwise. Please make sure to check the path where you have downloaded and extracted the Xcode
Now unlike other downloaded applications, on extraction, Xcode doesn't give the option to move it to Applications
Note the XCODE-ACTUAL-LOCATION or move it to the Applications
Note if you have downloaded Xcode or Xcode-beta
Based on 4 and 5, execute one of the commands (Do not execute all of them without reading above description):
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
sudo xcode-select -s /[XCODE-ACTUAL-LOCATION]/Xcode.app/Contents/Developer
sudo xcode-select -s /[XCODE-ACTUAL-LOCATION]/Xcode-beta.app/Contents/Developer
Install Xcode from App Store. After installing run xcodebuild with root privileges i.e. sudo xcodebuild and accept the language. After this npm install bcrypt worked like a charm!
Without Xcode: create file /usr/local/bin/xcodebuild with content to cheat XcodeSelect
#!/bin/bash
exit 0
chmod +x /usr/local/bin/xcodebuild
In case you are using Xcode beta, run
sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
instead of
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
I was able to solve this error without installing the full Xcode application. You must, however, have xcode command line tools installed.
From here:
$ cd /usr/bin
$ sudo mv xcodebuild xcodebuild.orig (A backup just in case)
$ vim xcodebuild
Paste the following:
#!/bin/bash
if [[ $1 == '-version' ]]; then
echo "Xcode 10.2.1"
echo "Build version 10E1001"
else
/usr/bin/xcodebuild.bak $#
fi
$ sudo chmod +x xcodebuild
XCode2:
sudo xcode-select -s /Applications/Xcode\ 2.app/Contents/Developer
Pay attention to the "\" to escape the space
I had two instance of Xcode installed xcode.app and xcode-beta.app
When I tried to create a build with netbeans it showed me the error
"supported version of xcode and command line tools not found netbeans"
I followed the following steps:
"xcode-select --print-path" is equal to "/Applications/Xcode.app/Contents/Developer"
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform" exists
"xcodebuild -version" starts with "Xcode"
after 1 I found that it is pointing me to xcode-beta.app
so here is the solution which worked like a charm:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
For context, today is Jan 28, 2019.
On my Mac, I did two things to resolve this problem:
Run the following command in your terminal:
sudo xcode-select --install
Restart your Mac.
Until I restarted the computer, the problem kept occurring in my Android Studio. After reboot, it was working just fine. Also note that I did not execute any --switch commands as others are doing. I hope this helps.
Manually installing Command LineTool worked for me.
I stalled xcode through App Store
Still could not download Homebrew
I installed Command Line Tool manually through link.
Bing Bang Boom
https://developer.apple.com/download/more/?=command%20line%20tools
sudo xcode-select -s /Applications/Xcode 10.app/Contents/Developer
languoguangs-iMac:/ languoguang$ sudo xcode-select -s /Applications/Xcode 10.app/Contents/Developer
xcode-select: error: invalid argument '10.app/Contents/Developer'
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
-p, --print-path print the path of the active developer directory
-s <path>, --switch <path> set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, --reset reset to the default command line tools path
languoguangs-iMac:/ languoguang$ sudo xcode-select -s "/Applications/Xcode 10.app/Contents/Developer"
because my Xcode name in Application is "Xcode 10",
sudo xcode-select -s "/Applications/Xcode 10.app/Contents/Developer"
works.
In my case,
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
didn't work because my Xcode had some special name. eg) Xcode_11.2.0_beta_2_stackoverflow.app
cd /applications
ls
Then I found my Xcode name, then replace it with
sudo xcode-select -s /Applications/{myXcodeName}.app/Contents/Developer
It worked for me.
None of the above worked for me. I originally installed Command Line Tools separately, and then all of Xcode. What worked for me was to uninstall Command Line Tools as shown here. Then, when trying to run xcode-select again, I was asked to reinstall them.
*By the way, the very reason why I found this thread was because I had installed some libraries (particularly gcc) with macports, presumably using the old Command Line Tools, and then I installed the full Xcode midway into development. So anyways, for my case, I had to reinstall macports after removing the stand-alone Command Line Tools, reinstalling them, reinstalling gcc, and then my compilation worked.
There are only two steps required, and the full XCode.app is not required at all:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
At this point the "Installing Softwre" dialog pops up:
That's it!
None of the above solutions helped me. I was working on an old project, and I had the latest version of NodeJs installed globally (v14.x) on my computer.
No node version above 10.1.x worked for me and when testing I received the same error as above.
Solution
I installed "n" which is a nodeJs version manager like nvm
I downgraded my nodeJs version to 9.x
npm install now works.
I will now need to update my versions, or Specify my node version in my package.json.
The simple fix that worked for me is drag and drop Xcode.app from the current location (In my case it was in downloads) to Applications.
With the release of Apple's Command Line Toolkit for Xcode, I am trying to avoid needing to install Xcode proper. In order to do this, I need to set the path to xcode for specific make files that depend on the xcode-select path (which is currently pointing to /Developer)
Where do I point the xcode-select path when using the CLI Toolkit for Xcode?
If I install Xcode, it's just /Applications/Xcode.app, but I don't know where the CLI Toolkit is being placed.
Thanks.
UPDATE:
It appears from the pkg installer that it dumps it all to /usr/bin and then xcode-select or other scripts internal to the pkg create the paths for xcodebuilder etc. Can anyone confirm?
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
I installed the CLI tools only (e.g. no Xcode) and received an error with a native gem extension build:
xcode-select: Error: No Xcode is selected. Use xcode-select -switch <path-to-xcode>, or see the xcode-select manpage (man xcode-select) for further information.
After looking at this and browsing the directories, it appears the BSD tools got installed in /usr/bin therefore:
sudo xcode-select -switch /
seems to work.
Just did this today after removing Xcode to reclaim HD space. I used:
sudo xcode-select -s /Library/Developer/CommandLineTools
I encountered this problem recently because I had several XCode versions installed on the same machine. If you have one or more XCode previously installed, you can simply reset the path with the command:
sudo xcode-select -r
This will reset the path to the default, which is /Library/Developer/CommandLineTools.
For my setup (Xcode 4.0.2 on 10.6.8), I used spotlight to search for 'xcodebuild' to find where the Xcode CLI tools actually live.
The CLI tools are in /Developer/usr/bin, so my xcode-select command looks like (the /usr/bin is appended by xcode-select):
sudo xcode-select -switch /Developer