Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Issue with Command Line Tools for Xcode #10245

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

Issue with Command Line Tools for Xcode #10245

tabletcorry opened this issue Feb 17, 2012 · 18 comments

Comments

@tabletcorry
Copy link

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
Copy link
Author

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
Copy link

Same issue on a clean 10.7 install with no Xcode.

@ghost
Copy link

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
Copy link

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

@tabletcorry
Copy link
Author

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

@ghost
Copy link

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
Copy link
Author

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
Copy link
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"

@mxcl mxcl closed this as completed in 4fd8f26 Feb 17, 2012
etehtsea pushed a commit to etehtsea/homebrew that referenced this issue Feb 17, 2012
Fixes Homebrew#10245.
Fixes Homebrew#10248.

Conflicts:

	Library/Homebrew/utils.rb
@notahat
Copy link
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
Copy link

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
Copy link
Contributor

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
Copy link

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
Copy link
Contributor

mxcl commented Mar 14, 2012

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

@marzagao
Copy link

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
Copy link

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
Copy link
Member

@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
Copy link

What @notahat said worked fine for me with Xcode 4.4.1

@jhubert
Copy link

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
@Homebrew Homebrew 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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests