XCode reinstall command-line tools

Justin Vallon justinvallon at gmail.com
Wed Sep 22 19:48:15 UTC 2021


I upgraded XCode, and encountered the "cltversion: The Command Line 
Tools are installed, but MacPorts cannot determine the version" error. 
It linked to https://trac.macports.org/wiki/ProblemHotlist#reinstall-clt.

That page talks about missing receipts, and downloading the command line 
tools manually.

I have found the following worked in both the previous XCode upgrade as 
well as this one, and is more straightforward:

( version of /Applications/XCode.app: 13.0 )
# port upgrade outdated
Warning: cltversion: The Command Line Tools are installed, but MacPorts 
cannot determine the version.
Warning: cltversion: For a possible fix, please see: 
https://trac.macports.org/wiki/ProblemHotlist#reinstall-clt
...
# xcode-select --install
xcode-select: error: command line tools are already installed, use 
"Software Update" to install updates
# ls -l /Library/Developer/CommandLineTools/
total 0
drwxr-xr-x  5 root  wheel  160 Jan  8  2021 Library
drwxr-xr-x  5 root  wheel  160 May 24 00:54 SDKs
drwxr-xr-x  7 root  wheel  224 Jan  8  2021 usr
# ls -l /Library/Developer/CommandLineTools/SDKs/
total 0
lrwxr-xr-x  1 root  wheel   14 Apr 29 21:49 MacOSX.sdk -> MacOSX11.3.sdk
drwxr-xr-x  7 root  wheel  224 Mar 16  2021 MacOSX11.3.sdk
lrwxr-xr-x  1 root  wheel   14 Apr 29 21:48 MacOSX11.sdk -> MacOSX11.3.sdk
# rm -rf /Library/Developer/CommandLineTools
# xcode-select --install
xcode-select: note: install requested for command line developer tools
( do the install via the UI )
# ls -l /Library/Developer/CommandLineTools/SDKs/
total 0
lrwxr-xr-x  1 root  wheel   14 Sep 22 10:59 MacOSX.sdk -> MacOSX11.3.sdk
drwxr-xr-x  8 root  wheel  256 Sep 22 10:59 MacOSX10.15.sdk
drwxr-xr-x  7 root  wheel  224 Nov 30  2020 MacOSX11.1.sdk
drwxr-xr-x  7 root  wheel  224 Sep 22 10:58 MacOSX11.3.sdk
lrwxr-xr-x  1 root  wheel   14 Sep 22 10:57 MacOSX11.sdk -> MacOSX11.3.sdk
# port upgrade outdated
( no error about cltversion:... )
--->  Computing dependencies for gcc11

If the /Library/Developer/CommandLineTools directory is removed, xcode 
will detect the tools are missing and (re)install them.

-- 
-Justin
JustinVallon at gmail.com


More information about the macports-users mailing list