Skip to content

Commit

Permalink
port diagnose: fix multiple issues with check_for_clt
Browse files Browse the repository at this point in the history
OS versions newer than 10.9 also use /Library/Developer/CommandLineTools.
`xcode-select --install` doesn't work on pre-10.9. There is no
xcode-select on Tiger. Also check for missing CLTs receipt.

Closes: https://trac.macports.org/ticket/53909
  • Loading branch information
jmroot committed Oct 1, 2023
1 parent 7e54e24 commit 99b91e6
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/macports1.0/diagnose.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ namespace eval diagnose {
proc check_for_clt {} {

# Checks to see if the Xcode Command Line Tools are installed by checking if the file
# /Library/Developer/CommandLineTools exists if the system is running 10.9, or if they're
# running an older version, if the command xcode-select -p outputs something.
# /Library/Developer/CommandLineTools exists if the system is running 10.9+, or if they're
# running an older version, if /usr/include exists.
#
# Args:
# None
Expand All @@ -148,26 +148,29 @@ namespace eval diagnose {

output "command line tools"

if {${macports::macos_version_major} eq "10.9"} {
if {[vercmp ${macports::macos_version_major} >= "10.9"]} {

if {![file exists "/Library/Developer/CommandLineTools/"]} {

ui_warn "Xcode Command Line Tools are not installed! To install them, please enter the command:
ui_warn "Xcode Command Line Tools do not appear to be installed. To install them, please enter the command:
xcode-select --install"
success_fail 0
return
} elseif {$macports::xcodecltversion eq "none"} {
ui_warn "The Xcode Command Line Tools package appears to be installed, but its receipt appears to be missing."
ui_warn "The Command Line Tools may be outdated, which can cause problems."
ui_warn "Please see: <https://trac.macports.org/wiki/ProblemHotlist#reinstall-clt>"
}
success_fail 1
return

} else {

set xcode_select [exec xcode-select -print-path]
if {![file exists "/usr/include"]} {

if {$xcode_select eq ""} {

ui_warn "Xcode Command Line Tools are not installed! To install them, please enter the command:
xcode-select --install"
ui_warn "Xcode Command Line Tools do not appear to be installed. \
To install them, please follow the instructions for your OS version at:
<https://guide.macports.org/#installing.xcode>"
success_fail 0
return
}
Expand Down

0 comments on commit 99b91e6

Please sign in to comment.