Issue with Command Line Tools for Xcode #10245

tabletcorry opened this Issue Feb 17, 2012 · 18 comments


None yet

After running the uninstaller for Xcode (sudo /Developer/Library/uninstall-devtools –mode=all) and installing the command line tools from apple, I see the following error whenever I run brew install:

$ brew install --debug zsh
Error: No such file or directory - /Users/chaines/Error: 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb:434:in `lstat'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb:434:in `realpath_rec'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb:467:in `realpath'
/usr/local/Library/Homebrew/utils.rb:272:in `default_cc'
/usr/local/Library/Homebrew/utils.rb:276:in `default_compiler'
/usr/local/Library/Homebrew/extend/ENV.rb:360:in `compiler'
/usr/local/Library/Homebrew/extend/ENV.rb:26:in `setup_build_environment'

I took a look at the ruby code running here and it looks like it is failing to understand the output of:

$ xcrun -find cc
xcode-select: Error: No Xcode folder is set. Run xcode-select -switch <xcode_folder_path> to set the path to the Xcode folder.
Error: /usr/bin/xcode-select returned unexpected error.

which it runs in /usr/local/Library/Homebrew/utils.rb line 270 or whereabouts.

I do have cc and friends:

$ which cc

Other info:

$ brew --version
$ brew log -1 --oneline
ec4f21e Remove OSX-GCC from brew-doctor

It looks like this is being discussed over in #9179 though its not clear what the solution is.


I just tried running xcode-select --switch / as suggested by @sorin-ionescu (in the other issue) and it appears to make brew run slower than snot (with no output).

Edit: More specifically it appears to get stuck running bash to do something. I tried running dtruss on the bash process but didn't see anything of value. I can gist it if someone thinks it will be helpful


Same issue on a clean 10.7 install with no Xcode.


I suspect a condition that doesn't continue, nor exit.

Ed1t: One trick is to set the xcode-select path to a different location which doesn't need to be a "Xcode-path". This will make Homebrew run, but xcrun to fail. E.g xcode-select -switch /usr


I had this issue and ran sudo xcode-select -switch /usr/bin and things seem to be installing now without a problem.


@beerlington I think we have a winner! Running it with /usr/bin does appear to fix the issue.


As described above. You set a directory which doesn't contain Xcode. If you run xcrun -find clang now. You will get the following:

~ $ xcrun -find clang
sh: /usr/bin/usr/bin/xcodebuild: No such file or directory
/usr/bin/usr/bin/xcodebuild fails with 32512 - Unknown error: 32512

It seems with this error, Homebrew is able to complete its tasks.


The difference is that xcrun -find cc outputs to stderr rather than stdout when given a path (and stdout when it has no path at all). When homebrew fails to find anything on stdout it guesses on the location of cc and succeeds.

Of course, it really should check the return codes and act more appropriately, but it looks like homebrew generally does not check return codes from system calls.


Do you have to run this if you just install the command line tools from a clean install?

"sudo xcode-select -switch /usr/bin"

@mxcl mxcl added a commit that closed this issue Feb 17, 2012
@mxcl mxcl Fix some default_cc behavior
Fixes #10245.
Fixes #10248.
@mxcl mxcl closed this in 4fd8f26 Feb 17, 2012
@etehtsea etehtsea added a commit to etehtsea/homebrew that referenced this issue Feb 17, 2012
@mxcl @etehtsea mxcl + etehtsea Fix some default_cc behavior
Fixes #10245.
Fixes #10248.


notahat commented Feb 18, 2012

This worked for me:

sudo xcode-select -switch /Applications/

Note that giving xcode-select any path with a trailing slash causes xcrun to lock up. Don't know why.

flips commented Mar 14, 2012

So, trying to install ntfs-3g, this seems to be a showstopper. I installed Command Line Tools for XCode on a clean 10.7.3 install. If I run "sudo xcode-select -switch /", then brew doctor is happy, but the build process stops at
/usr/bin/xcodebuild -sdk macosx10.7 -configuration Release [...]
for fuse4x_0_9_0 ...

I select /usr/bin, /usr or anything else, it fails ...
So, what should I do? Wait? (I've run "brew update" ...)

mxcl commented Mar 14, 2012

I believe brew doctor tells you not to set xcode-select to /. It exposes a bug in xcode-select that causes it to hang forever.

Now you need to unset it. I forget how.

flips commented Mar 14, 2012

Yes, brew doctor told me that no setting would work for command line only installs yet. (Then I Googled and found this thread.) But it did fail also before I disobeyed brew doctor and tried setting something ... So, is this something I should just wait for, then?
(What's the punishment for disobeying the brew doctor?) ;)

mxcl commented Mar 14, 2012

Please report a new bug once you have unset xcode-select.


One way to unset xcode-select is remove the file that was created when you used the -switch option:

sudo rm /usr/share/xcode-select/xcode_dir_path
sha1dy commented May 27, 2012

so what should we do with ntfs-3g? it still fails on 10.7 clean install with XCode command line tools...


@sha1dy Please don't bump unrelated issues.

Unfortunately ntfs-3g doesn't work with just the command line tools - that's not something we can fix. For now, you need a full Xcode to build it.

@Sharpie Sharpie pushed a commit to Sharpie/homebrew that referenced this issue Jun 18, 2012
@mxcl mxcl Fix some default_cc behavior
Fixes #10245.
Fixes #10248.

What @notahat said worked fine for me with Xcode 4.4.1

jhubert commented Oct 31, 2012

fwiw, this was a super easy solution that worked for me:

@snakeyroc3 snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this issue Dec 17, 2012
@mxcl mxcl Fix some default_cc behavior
Fixes #10245.
Fixes #10248.
@xu-cheng xu-cheng locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.