Help us understand the problem. What is going on with this article?

最新版の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も最新版。謎。
Screen Shot 2019-12-10 at 17.27.06.png

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

% 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を導入している場合、何らかのきっかけでバージョン不整合が生じる模様。

対処法

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

導入後、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.
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away