最新版のCLTをインストール済にもかかわらず、brewに「CLTをUpdateしろ」って怒られる場合の対処法


現象

brew doctorを実行すると、下記のようなWarningが出力される。

% brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or
https://developer.apple.com/download/more/.

System Preferenceで更新を確認しても、すでに最新。Xcodeも最新版。謎。

この際のバージョン情報は下記のような感じ

% brew --config
HOMEBREW_VERSION: 2.2.1
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2fe99bd9823fadea1cf918b1ed8366de7f40d336
Last commit: 28 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 9f1e6ddd2b9bf2e1df1d82c7da9187ff674ddfda
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
CPU: quad-core 64-bit skylake
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
Clang: 11.0 build 1100
Git: 2.24.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 10.15.1-x86_64
CLT: 1100.0.33.8
Xcode: 11.2.1

原因

XCodeとセットのCLTを導入している場合、何らかのきっかけでバージョン不整合が生じる模様。

対処法

単体版のCLTを導入する。
Warningに従って https://developer.apple.com/download/more/ にアクセスし、最新CLTのdmgをダウンロード -> インストールする。

導入後、CLTのバージョンが更新されていることを確認

% brew --config
HOMEBREW_VERSION: 2.2.1
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2fe99bd9823fadea1cf918b1ed8366de7f40d336
Last commit: 28 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 9f1e6ddd2b9bf2e1df1d82c7da9187ff674ddfda
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
CPU: quad-core 64-bit skylake
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
Clang: 11.0 build 1100
Git: 2.24.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 10.15.1-x86_64
CLT: 11.2.0.0.1.1571444319 # <----- 更新されてる
Xcode: 11.2.1
CLT headers: 11.2.0.0.1.1571444319

Warningも解消されてる。

% brew doctor
Your system is ready to brew.