Mac OS X Terminal error: invalid developer directory '/Applications/Xcode-5.1.1.app' - xcode

I'm trying to setup and install theos in my Mac OS X El Capitan with terminal. I'm following iPhoneDevWiki (http://iphonedevwiki.net/index.php/Theos/Setup) and doing every single step correctly, I've done it multiple times but everytime I get this little error. I already have all dependencies, the problem comes when I do the following command:
git clone git://git.saurik.com/ldid.git
fatal: destination path 'ldid' already exists and is not an empty directory.
cd ldid
git submodule update --init
./make.sh
Password:
xcode-select: error: invalid developer directory '/Applications/Xcode-5.1.1.app
I have put my password and it did show the error. I have already tried the following commands:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcode-select -s </Applications/Xcode.app/Contents/Developer>
This second one actually leads me to an error of "newline" or something like that.
My xcode version is not 5.1.1, I don't even know why my Terminal is saying Xcode.app is Xcode-5.1.1!
xcode-select -v
xcode-select version 2343.
I have already tried to put the command:
xcode-select -p
The output is:
/Applications/Xcode.app/Contents/Developer
So, if that is the output, why it is saying my developer directory is "/Applications/Xcode-5.1.1.app" ?
Please help me!

Open make.sh file inside ldid folder. In line 16 edit the path to:
/Applications/Xcode.app/Contents/Developer
Then run ./make.sh again.

Change the name of your Xcode app to Xcode-5.1.1 in the Applications folder. That worked for me.

Related

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

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.

sudo xcode select switch command not working

sudo xcode-select -switch /Applications/Xcode.app command not working, I have a OS Sierra and Xcode 8 installed. I either get no reply and command moves to next line or i get an error. Please Help i want to change directory
You need to run xcode-select as root. Therefore, simply execute the following command in Terminal:
sudo xcode-select -s "/Applications/Xcode.app"
Check your setting for DEVELOPER_DIR environment variable. You may be over-riding it. Find out with:
echo $DEVELOPER_DIR
In your ~/.bash_profile add:
export DEVELOPER_DIR=/Applications/Xcode.app
Found the answer in https://forums.developer.apple.com/thread/13629

Errors during make test installing kibana via homebrew on Mac (xcode issue?) [duplicate]

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.

xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist

I'm having xcode issues when I try to use brew and git:
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select)
I can type xcode-select and it shows that the command exists. When I type xcode-select -p it shows:
/Applications/Xcode.app/Contents/Developer
but when I do which xcode-select, it gives me:
/usr/bin/xcode-select
I've tried to use the command switch and install again via Apple Developer site but none of these options have work so far... How can I fix this?
I tried that and it didn't work but I found the answer. I just had to reset the developer's path:
$ sudo xcode-select --reset
Now everything is normal
Mostly this error occurs when you have installed a newer version of xcode. And the command line tools are yet to be initialized.
To resolve this:
Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Please select the Xcode version for tools.
Example (For Xcode 10.0 (10A255) ):
Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Select Xcode 10.0 (10A255).
For more details please see this image:
In my case, I had uninstalled Xcode and then issues with git cli started. I solved the problem running the following commands:
$ sudo xcode-select -r
$ sudo xcode-select --switch /Library/Developer/CommandLineTools
and then validating new path with:
$ sudo xcode-select -p
I have faced the same issue as I have uninstalled the XCode abruptly, running the below command (from Terminal) helped me to resolve this.
sudo xcode-select -switch /
This error coming because xcode get deleted, corrupt or moved.
In my case i removed xcode from my Mac and faced the same issue.
I fixed it by simple two steps
Open Terminal
Simply run following command
sudo xcode-select -r
And now error has resolved. Hope it will helpful.
Use this:
sudo xcode-select -switch /
This should solve the problem.
How about what the error suggests? Did you try that?
xcode-select --switch /Applications/Xcode.app
That should do the trick.
For me it helps to install Xcode CLI
xcode-select --install
after uninstalling XCode (I don't develop for the OSx or iOS)
Then I could successfully build downloaded source with make
Try error suggestion :
sudo xcode-select --switch /Applications/Xcode.app
And Then test Git Executable Path.
I had the same problem and had to remove completely Developer tools, and reinstall:
$ rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
Tip: because Xcode had been improperly uninstalled, I had to manually (re)move the Xcode app, too:
$ mv /Applications/Xcode.app/ /Applications/Xcode.app.bak
In my case such error occurred after I has tried to symbolicate crash report, and according to a manual, entered command export DEVELOPER_DIR=”/Applications/Xcode.app/Contents/Developer”
I tried some proposed here solutions but nothing helped.
Then I realized that I have added an environment variable DEVELOPER_DIR to my terminal and this led to error: "xcrun: error: missing DEVELOPER_DIR path:"
Then I've just reboot my terminal, that cleaned the environment variable and the error disappeared.
(FYI: environment variables may be checked with printenv command in terminal)
for my mbp m1 apple sillicon for the case alr tried all the above answer and not solved.
i have solved by here discussion https://developer.apple.com/forums/thread/660641
there is have 2 option to solve, my case...
i have uninstalled xcode because i don't need again
install standalone mode, doesnt work. can't install the software
solved by try download manual command line tools check on the discussion thread for the link file ( 741.5 MB ) .

xcode-select active developer directory error

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.

Resources