cask "dotnet-sdk@preview" do arch arm: "arm64", intel: "x64" on_arm do version "9.0.100,2787e86a-6efe-4c4d-a3d1-8fd8c302c639,d386f92a6b2b819cb11cc0382dc98bc7" sha256 "f0cf7f4369aabcdda674d2e7ffd1154c769057fc9149a380fc48b32184618c21" end on_intel do version "9.0.100,ce4a7dd7-1baa-45b1-a447-76cac8d50218,128808a7422ca2e0ae37901d7c78cd53" sha256 "07d5ded3aa3e73a3b881a231574cc4d24fc507e316232cd0ed82cf6dc2e85625" end url "https://download.visualstudio.microsoft.com/download/pr/#{version.csv.second}/#{version.csv.third}/dotnet-sdk-#{version.csv.first}-osx-#{arch}.pkg" name ".NET SDK" desc "Developer platform" homepage "https://dotnet.microsoft.com/en-us/" livecheck do url "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/#{version.major_minor}/releases.json" regex(%r{/download/pr/([^/]+)/([^/]+)/dotnet-sdk[._-]v?(.+)[._-]osx[._-]#{arch}\.pkg}i) strategy :json do |json, regex| json["releases"]&.map do |release| release.dig("sdk", "files")&.map do |file| file["url"]&.scan(regex)&.map { |match| "#{match[2]},#{match[0]},#{match[1]}" } end end&.flatten end end conflicts_with cask: [ "dotnet", "dotnet-sdk", "dotnet@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.*", "com.microsoft.netstandard.pack.targeting.*", ], delete: [ "/etc/paths.d/dotnet", "/etc/paths.d/dotnet-cli-tools", ] zap trash: [ "~/.dotnet", "~/.nuget", ] end