cask "dotnet-sdk" do arch arm: "arm64", intel: "x64" version "9.0.302" sha256 arm: "1516e833ef7c709be7d5c0dc75d8e9ca15f52052e1cddb7dc279eb95a29f0517", intel: "d85649528343b54e411cac28c8c824e053371d5e9a84868048f983001765d9e6" url "https://builds.dotnet.microsoft.com/dotnet/Sdk/#{version}/dotnet-sdk-#{version}-osx-#{arch}.pkg" name ".NET SDK" desc "Developer platform" homepage "https://www.microsoft.com/net/core#macos" # This identifies releases with the same major/minor version as the current # cask version. New major/minor releases occur annually in November and the # check will automatically update its behavior when the cask is updated. livecheck do url "https://builds.dotnet.microsoft.com/dotnet/release-metadata/#{version.major_minor}/releases.json" regex(/^v?(\d+(?:\.\d+)+)$/i) strategy :json do |json, regex| json["releases"]&.map do |release| version = release.dig("sdk", "version") next unless version&.match(regex) version end end end conflicts_with cask: [ "dotnet-runtime", "dotnet-runtime@preview", "dotnet-sdk@preview", ], formula: "dotnet" depends_on macos: ">= :mojave" pkg "dotnet-sdk-#{version.csv.first}-osx-#{arch}.pkg" binary "/usr/local/share/dotnet/dotnet" uninstall pkgutil: [ "com.microsoft.dotnet.*#{version.major_minor}*#{arch}", "com.microsoft.dotnet.sharedhost*#{arch}", "com.microsoft.netstandard.pack.targeting.*", ] zap pkgutil: "com.microsoft.dotnet.*", delete: [ "/etc/paths.d/dotnet", "/etc/paths.d/dotnet-cli-tools", ], trash: [ "~/.dotnet", "~/.nuget", ] end