xcode-select error while trying to install Homebrew on macOS Sierra - macos

While trying to install Homebrew on macOS Sierra:
xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools

Yes , i have solved this error by using following steps.
In your terminal write command ::  xcode-select --install
after doing step no 1 you will get one popUp , so click on install

I had the same error and the only way I could get around it was to install the Xcode command line tools manually by downloading them directly from developer.apple.com. Once installed the brew install worked without issue.

The easiest way to handle this issue is to run:
xcode-select --install

Unfortunately I can’t make comments, so I’ll post it as an answer:
If selecting the correct Xcode version for Homebrew is what you are trying to achieve, then try this:
For Xcode release:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
For Xcode beta:
sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer

I resolved this error by installing the latest version of Xcode.

I tried installing Command Line Tools manually, but Command Line Tools get failed while installing. Reinstalling XCode did not help at all.
So I attempted below command helped me resolve this error on Big Sur 11.2.1 (20D74)
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Related

Xcode CommandLineTools installed but still getting the error: Xcode alone is not sufficient on Monterey

I have MacOS Montery 12.3.1 and I have already installed Xcode and installed CommandLineTools long time ago.
I have Xcode-select version:
xcode-select version 2395.
Now, while trying to install heroku cli I got the error:
Error: Xcode alone is not sufficient on Monterey.
Install the Command Line Tools: xcode-select --install
But the command:
xcode-select --install
the installation now would last 89 hours and it tries to download 15GB which can't be right...
sudo xcode-select --switch /Applications/Xcode.app
sudo xcode-select --switch /Library/Developer/CommandLineTools
I tried this but the second command throws the error:
xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
the folder CommandLineTools is in that directory... I am clueless. Thank you for your help.
The solution that worked for me was to deinstall Xcode(and everything related) and Homebrew. After reinstalling Xcode the CommandLineTools got installed with Homebrew and are working fine again.

Home-brew installation fails on High Sierra

I am trying to install Homebrew on a Mac mini with High Sierra v10.13. I run the following command as instructed:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The terminal informs me that it will install brew and asks password, but it eventually fails and shows the following message:
The operation couldn’t be completed. (NSURLErrorDomain error -1012.)
==> Installing
==> /usr/bin/sudo /usr/sbin/softwareupdate -i
Software Update Tool
: No such update
No updates are available.
==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
Please help me solve this issue. Thanks.
I had a similar problem, so I am posting this here to help anyone in pain !
The command brew doctor tells me that some installed formulae are missing dependencies.
After doing the command brew upgrade, I get the error for some dependencies (below is the example for openjdk) :
configure: error: No xcodebuild tool and no system framework headers found, use --with-sysroot or --with-sdk-name to provide a path to a valid SDK
/private/tmp/openjdk-20200219-89506-1wim844/jdk13u-jdk-13.0.2+8/build/.configure-support/generated-configure.sh: line 82: 5: Bad file descriptor
configure exiting with result code 1
These open issues may also help:
Migrate formulae to depend on `openjdk`.
Here is how I solved this :
sudo xcode-select -r
Edit and set the date of your Mac as October 1st, 2019
sudo xcodebuild -runFirstLaunch
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
brew upgrade
And it worked ! (i am using a iMac mid2011 with MacOS Sierra)
I managed to solve it with help from a senior programmer.
The error was due to absence of Xcode Command Line Interface even though it was showing present in Xcode>>preference>>Location>>Command Line Tools.
So, I had to manually download the Command Line Interface dmg file from my Apple Accounts download section and install it.

Brew Install Error Xcode alone is not sufficient on Sierra

I'm attempting to install a package on Mac OSX Serra v10.12.6 running xCode v9.1 using HomeBrew v1.3.8.
The install and error is
TS-Mac-Pro > brew install dos2unix
Error: Xcode alone is not sufficient on Sierra.
Install the Command Line Tools:
xcode-select --install
Then I run the command
xcode-select --install
which says the command line tool package is not available from the software update server.
Which I go into xCode it shows that the command line tools are installed.
TS-Mac-Pro > xcode-select -p
/Applications/Xcode.app/Contents/Developer
Any help would be much appreciated.
Theo
I went to Apple Developer website and downloaded the Command Line Tools dmg directly. An Apple account first needs to be setup.
The Command Line Tools can be found under -
https://developer.apple.com/download/more/
Install downloaded dmg and volia - HomeBrew is back up and running.
I just fixed this issue by deleting the current install of the command line tools and reinstalling them. See commands below:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
This fixed the issue for me in the end

Homebrew cannot find installed command line tools

I have installed command line tools through Xcode. When I ran xcode-select -p, its showed /Applications/Xcode.app/Contents/Developer.
However, when I ran brew config, it showed CLT: N/A. And when I updated python using brew, it showed Warning: Building python from source: The bottle needs the Apple Command Line Tools to be installed.
I've got the same issue just now. Running xcode-select --install to reinstall Command Line Tools worked for me, brew config now reports CLT: 7.3.1.0.1.1461711523.
As xcode-select --install did not solve the issue for me:
I had to run brew doctor which listed Warning: Some installed formula are missing dependencies. including a brew install command to fix these. After running that, brew config reported CLT no longer as N/A.
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.
If you've installed the standalone version of the CLI tools (and don't have the full xcode application):
sudo xcode-select --switch /Library/Developer/CommandLineTools
(path courtesy of https://stackoverflow.com/a/40008480/758177)
For the same dependency issue above,
xcode-select --install and clicking "Install" on the pop-up fixes this in MacOS Catalina. Once complete, you can confirm it by typing xcode-select -v in the terminal and the output should look similar to this

How to set active developer directory with ‘xcode-select’ for Qt installation?

I'm trying to install the latest version of Qt for mac (https://www.qt.io/). But when I try to install I get an error.
You need to install Xcode http://developer.apple.com/xcode. If already
installed, then set active developer directory with ‘xcode-select’.
I've now installed xcode 7.3.1, and then ran the following in terminal:
sudo xcode-select -switch /Applications/Xcode.app
But I'm still running into the same error (see screenshot).
Can anyone advise how I might troubleshoot this?
This fixed my error.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
It came from the answer here. https://stackoverflow.com/a/17980786/2009221
The first time I clicked OK the error reappeared. The second time it was accepted and the installation continued.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer did not work for me as xcode-select still marked the directory as invalid. I created a symlink to homebrew's internal target xcode dev tools directory via:
sudo ln -s /Applications/Xcode.app/Contents/Developer /Library/Developer/CommandLineTools
Reinstalling homebrew after creating the above symlink worked for me.
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Resources