macOSで.NET Core Runtime/SDKをアンインストールする方法

この記事は公開から3年以上経過しています。

macOS Monterey で、pkgからインストールした.NET Core Runtime/SDKのアンインストールを行う方法。


手順

  1. こちらのGitHubサイトを開き、最新のリリースノートにあるAssetsからdotnet-core-uninstall.tar.gzをダウンロードする。

  2. 手順1でダウンロードしたdotnet-core-uninstall.tar.gzを解凍する。

  3. ターミナルを開き、手順2で解凍したdotnet-core-uninstallのあるディレクトリにカレントを移動する。

  4. 以下のコマンドを実行してシステムにインストールされている.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. 今回は5.0.404SDKのみをアンインストールしたいため、以下のコマンドを実行する。

    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]
  6. ここでyを入力すると指定されたSDKの削除処理が実行され、以下のように結果表示が行われる。

    Uninstalling: Microsoft .NET Core SDK 5.0.404 (x64).

以上でアンインストールは終了です。
再度手順4のコマンドを実行すると、以下のとおり5.0.404SDKがアンインストールできていることが確認できます。

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)


参考ウェブサイトなど

以上です。

シェアする

  • このエントリーをはてなブックマークに追加

フォローする