Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issue with Command Line Tools for Xcode #10245

Closed
tabletcorry opened this Issue · 18 comments
@tabletcorry

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'
/usr/local/Library/Homebrew/build.rb:23
/usr/local/Library/Formula/zsh.rb:25

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
/usr/bin/cc

Other info:

$ brew --version
0.8.1
$ 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.

@tabletcorry

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

@djohnson

Same issue on a clean 10.7 install with no Xcode.

@MindTooth

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

@beerlington

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

@tabletcorry

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

@MindTooth

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.

@tabletcorry

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.

@sjonnet19

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 closed this issue from a commit
@mxcl mxcl Fix some default_cc behavior
Fixes #10245.
Fixes #10248.
4fd8f26
@mxcl mxcl closed this in 4fd8f26
@etehtsea etehtsea referenced this issue from a commit in etehtsea/homebrew
@mxcl mxcl Fix some default_cc behavior
Fixes #10245.
Fixes #10248.

Conflicts:

	Library/Homebrew/utils.rb
9248401
@notahat

This worked for me:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

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

@mtandersson mtandersson referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@Crazor Crazor referenced this issue from a commit
@mxcl mxcl Fix some default_cc behavior
Fixes #10245.
Fixes #10248.
7125c5a
@Sharpie Sharpie referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@bric3 bric3 referenced this issue from a commit
@mxcl mxcl Fix some default_cc behavior
Fixes #10245.
Fixes #10248.
22619d3
@flips

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
Collaborator

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

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
Collaborator

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

@MNeise MNeise referenced this issue from a commit
@mxcl mxcl Fix some default_cc behavior
Fixes #10245.
Fixes #10248.
385202e
@cacoco cacoco referenced this issue from a commit
@mxcl mxcl Fix some default_cc behavior
Fixes #10245.
Fixes #10248.
f70f566
@marzagao

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

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

@mistydemeo
Owner

@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 referenced this issue from a commit in Sharpie/homebrew
@mxcl mxcl Fix some default_cc behavior
Fixes #10245.
Fixes #10248.
78dccaf
@mackrauss

What @notahat said worked fine for me with Xcode 4.4.1

@snakeyroc3 snakeyroc3 referenced this issue from a commit in snakeyroc3/homebrew
@mxcl mxcl Fix some default_cc behavior
Fixes #10245.
Fixes #10248.
c63721a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.