ytooyamaのブログ

サーバ構築とか、仕事で発見したこととか、趣味のこととかを書いています。

macOSのCommand Line Toolsのアップデートを止める/再開する

前回、次のような話を書きました。 ytooyama.hatenadiary.jp

今回は「Command Line Toolsのアップデートを止める/再開する」方法だけをこのページにまとめます。

Command Line Toolsを削除するには

以下のディレクトリーにCommand Line Toolsがインストールされるので、消してインストールしたいCommand Line Toolsをダウンロードしてインストールするだけです。

 sudo rm -rf /Library/Developer/CommandLineTools/

Command Line Toolsをダウンロードするには

Command Line ToolsはApple Developerサイトからダウンロードします。 Apple IDとDeveloper ID(ともに無料)が必要です。

developer.apple.com

Command Line Toolsの自動更新をブロックするには

Command Line Toolsの自動更新については以下のスレッドにヒントがありました。 macOS Catalinaでは softwareupdate --ignore を使う方法が有効だそうです。

developer.apple.com

$ softwareupdate --ignore "Command Line Tools beta 5 for Xcode"
Ignored updates:
(
    "Command Line Tools beta 5 for Xcode"
)

Software Update can only ignore updates that are eligible for installation.
If the label provided to ignore is not in the above list, it is not eligible
to be ignored.

Ignoring software updates is deprecated.
The ability to ignore individual updates will be removed in a future release of macOS.

$ softwareupdate --ignore "Command Line Tools for Xcode"
Ignored updates:
(
    "Command Line Tools beta 5 for Xcode",
    "Command Line Tools for Xcode"
)

Software Update can only ignore updates that are eligible for installation.
If the label provided to ignore is not in the above list, it is not eligible
to be ignored.

Ignoring software updates is deprecated.
The ability to ignore individual updates will be removed in a future release of macOS.

ブロックしたCommand Line Toolsを取り消すには

アップデートの除外を取り消す場合は softwareupdate --reset-ignored を実行します。実行すると例外として定義していたアップデートのブロックが全て解除されます。

このブログサイトはJavaScriptを使っていますが、読み込んでいるJavaScriptは全てはてなが提供しているものであり、筆者が設置しているものではありません。