doctor: suggest the correct xcode-select path to the user

Shortened the part about the CLT-only systems, because this message is
never shown to them.

Closes Homebrew/homebrew#13061.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
samueljohn 2012-06-26 12:19:12 +02:00 committed by Jack Nagel
parent 8f6ee31004
commit 4aed55cccb

View File

@ -403,27 +403,15 @@ def check_xcode_prefix
end end
def check_xcode_select_path def check_xcode_select_path
path = `xcode-select -print-path 2>/dev/null`.chomp
# with the advent of CLT-only support, we don't need xcode-select # with the advent of CLT-only support, we don't need xcode-select
return if MacOS.clt_installed? return if MacOS.clt_installed?
unless File.directory? path and File.file? "#{path}/usr/bin/xcodebuild" and not MacOS.xctools_fucked? unless File.file? "#{MacOS.xcode_folder}/usr/bin/xcodebuild" and not MacOS.xctools_fucked?
# won't guess at the path they should use because it's too hard to get right path = MacOS.app_with_bundle_id(MacOS::XCODE_4_BUNDLE_ID) or MacOS.app_with_bundle_id(MacOS::XCODE_3_BUNDLE_ID)
# We specify /Applications/Xcode.app/Contents/Developer even though path = '/Developer' if path.nil? or not path.directory?
# /Applications/Xcode.app should work because people don't install the new CLI
# tools and then it doesn't work. Lets hope the location doesn't change in the
# future.
<<-EOS.undent <<-EOS.undent
Your Xcode is configured with an invalid path. Your Xcode is configured with an invalid path.
You should change it to the correct path. Please note that there is no correct You should change it to the correct path:
path at this time if you have *only* installed the Command Line Tools for Xcode. sudo xcode-select -switch #{path}
If your Xcode is pre-4.3 or you installed the whole of Xcode 4.3 then one of
these is (probably) what you want:
sudo xcode-select -switch /Developer
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
DO NOT SET / OR EVERYTHING BREAKS!
EOS EOS
end end
end end