Xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools' Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools


(Eva) #1

Hi, I’m getting this error while installing. I used the installation command sr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” and all goes well past entering password. In the end I get this error. Can you tell me how to solve it. I’m new to Mac and just used the terminal for the first time.


(Mike McQuaid) #2

What version of macOS are you running?


(Eva) #3

HI Mike, I’m using Sierrra 10.12.3


(Mike McQuaid) #4

Try to run xcode-select --install and run the installer again. Thanks!


(StealthBadger747) #5

Sorry to bring up an old thread, but I am having the same issue, with High Sierra 10.13.1 and I cannot run xcode-select --install because it says 'cannot install software once I run it an it tries downloading. Thus I installed full xcode and it still doesn’t work.

This is the output:

xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools

(MaheshC) #6

I am having the same issue on High Sierra 10.13.2. Installed xcode from the App Store but still it doesn’t work.

xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools' Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools


(Prtysh) #7

Facing the same issue. The installer is pointing at the wrong path for Xcode. Trying to understand how to correct it.


#8

Has anyone found a solution for this? I’m receiving the same error and have the same problem with the install.


(Mick Mak) #9

Try to install the command line tools following this answer if you are using Mac:

brew seems checks if the command line tools installed in this path:

/Library/Developer/CommandLineTools

My case is: I tried to install brew on my new mac. After I installed Xcode, there was nothing in the above path but the command line tools were somehow installed to another location. (xcode-select -p tell me it was /Applications/Xcode.app/Contents/Developer)
The way in stackoverflow can install the command line tools to

/Library/Developer/CommandLineTools

Now I got brew working. But I am not sure if it is the best solution as there should be two copies of command line tools on my machine using this method.


(Huangrongfu) #10

thanks, i run

xcode-select --install

and it is work


(Shuchitaprasad) #11

The reason for this issue is that Xcode is not installed. I installed Xcode first, then went to https://developer.apple.com/download/more/ after which I logged with my apple id and then selected command line toll corresponding to my Xcode version. After this error was resolved