This repository has been archived by the owner. It is now read-only.

Issue with Command Line Tools for Xcode #10245

Closed
tabletcorry opened this Issue Feb 17, 2012 · 18 comments

Comments

Projects
None yet
@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

This comment has been minimized.

Show comment
Hide comment
@tabletcorry

tabletcorry Feb 17, 2012

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

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

This comment has been minimized.

Show comment
Hide comment
@djohnson

djohnson Feb 17, 2012

Same issue on a clean 10.7 install with no Xcode.

Same issue on a clean 10.7 install with no Xcode.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 17, 2012

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

ghost commented Feb 17, 2012

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

This comment has been minimized.

Show comment
Hide comment
@beerlington

beerlington Feb 17, 2012

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

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

@tabletcorry

This comment has been minimized.

Show comment
Hide comment
@tabletcorry

tabletcorry Feb 17, 2012

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

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

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 17, 2012

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.

ghost commented Feb 17, 2012

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

This comment has been minimized.

Show comment
Hide comment
@tabletcorry

tabletcorry Feb 17, 2012

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.

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

This comment has been minimized.

Show comment
Hide comment
@sjonnet19

sjonnet19 Feb 17, 2012

Contributor

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

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

Contributor

sjonnet19 commented Feb 17, 2012

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 in 4fd8f26 Feb 17, 2012

etehtsea added a commit to etehtsea/homebrew that referenced this issue Feb 17, 2012

Fix some default_cc behavior
Fixes #10245.
Fixes #10248.

Conflicts:

	Library/Homebrew/utils.rb
@notahat

This comment has been minimized.

Show comment
Hide comment
@notahat

notahat Feb 18, 2012

Contributor

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.

Contributor

notahat commented Feb 18, 2012

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.

@flips

This comment has been minimized.

Show comment
Hide comment
@flips

flips 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" ...)

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

This comment has been minimized.

Show comment
Hide comment
@mxcl

mxcl Mar 14, 2012

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@flips

flips 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?) ;)

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

This comment has been minimized.

Show comment
Hide comment
@mxcl

mxcl Mar 14, 2012

Member

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

Member

mxcl commented Mar 14, 2012

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

@marzagao

This comment has been minimized.

Show comment
Hide comment
@marzagao

marzagao Apr 25, 2012

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

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

This comment has been minimized.

Show comment
Hide comment
@sha1dy

sha1dy 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 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...

@mistydemeo

This comment has been minimized.

Show comment
Hide comment
@mistydemeo

mistydemeo May 27, 2012

Contributor

@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.

Contributor

mistydemeo commented May 27, 2012

@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 pushed a commit to Sharpie/homebrew that referenced this issue Jun 18, 2012

@mackrauss

This comment has been minimized.

Show comment
Hide comment
@mackrauss

mackrauss Aug 31, 2012

What @notahat said worked fine for me with Xcode 4.4.1

What @notahat said worked fine for me with Xcode 4.4.1

@jhubert

This comment has been minimized.

Show comment
Hide comment

jhubert commented Oct 31, 2012

fwiw, this was a super easy solution that worked for me: http://stackoverflow.com/questions/13041525/osx-10-8-xcrun-no-such-file-or-directory

snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this issue Dec 17, 2012

@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.