この記事は公開から3年以上経過しています。
macOS Monterey で、pkgからインストールした.NET Core Runtime/SDKのアンインストールを行う方法。
手順
-
こちらのGitHubサイトを開き、最新のリリースノートにある
Assets
からdotnet-core-uninstall.tar.gz
をダウンロードする。 -
手順1でダウンロードした
dotnet-core-uninstall.tar.gz
を解凍する。 -
ターミナルを開き、手順2で解凍した
dotnet-core-uninstall
のあるディレクトリにカレントを移動する。 -
以下のコマンドを実行してシステムにインストールされている.NET Core Runtime/SDKを調べる。
./dotnet-core-uninstall list
ここで
"dotnet-core-uninstall"は、開発元を検証できないため開けません。
と表示されてコマンドが実行できない場合は、
システム環境設定
のセキュリティとプライバシー
を開き、ダウンロードしたアプリケーションの実行許可:
のこのまま許可
ボタンを押下して実行を許可する。私の環境の場合での
dotnet-core-uninstall
実行結果は以下の通り。This tool cannot uninstall versions of the runtime or SDK that are installed using zip/scripts. The versions that can be uninstalled with this tool are: .NET Core SDKs: 6.0.100 (arm64) [Used by Visual Studio for Mac. Specify individually or use —-force to remove] 5.0.404 (x64) .NET Core Runtimes: 6.0.0 (arm64) [Used by Visual Studio for Mac or SDKs. Specify individually or use —-force to remove] 6.0.0 (x64)
-
今回は
5.0.404
のSDK
のみをアンインストールしたいため、以下のコマンドを実行する。sudo ./dotnet-core-uninstall remove --sdk 5.0.404
上記コマンドを実行すると、以下のようにVisual Studio for Macが壊れる問題を避けるためにリンク先ドキュメントを読むようにとの注意書きと、継続を確認するプロンプトが表示される(オプション指定や使い方の詳細が書かれているため確認しておくことを推奨)。
The following items will be removed: Microsoft .NET Core SDK 5.0.404 (x64) To avoid breaking Visual Studio for Mac or other problems, read https://aka.ms/dotnet-core-uninstall-docs. Do you want to continue? [y/n]
-
ここで
y
を入力すると指定されたSDKの削除処理が実行され、以下のように結果表示が行われる。Uninstalling: Microsoft .NET Core SDK 5.0.404 (x64).
以上でアンインストールは終了です。
再度手順4のコマンドを実行すると、以下のとおり5.0.404
のSDK
がアンインストールできていることが確認できます。
This tool cannot uninstall versions of the runtime or SDK that are installed using zip/scripts. The versions that can be uninstalled with this tool are:
.NET Core SDKs:
6.0.100 (arm64) [Used by Visual Studio for Mac. Specify individually or use —-force to remove]
.NET Core Runtimes:
6.0.0 (arm64) [Used by Visual Studio for Mac or SDKs. Specify individually or use —-force to remove]
6.0.0 (x64)
参考ウェブサイトなど
- Microsoft Docs
.NET アンインストール ツール
以上です。