cask "virtualbox@beta" do arch arm: "macOSArm64", intel: "OSX" version "7.1.5-165548" sha256 arm: "a1b4bdc60dc745779a5b4d367eb55b3be0b936fea9311416910f319686a1fadf", intel: "e8ce6dc960392c8d8aaa9d41cb0a18571e67bc1b5cb678e7c0dc44c3bbc9ff40" url "https://www.virtualbox.org/download/testcase/VirtualBox-#{version}-#{arch}.dmg" name "Oracle VirtualBox" desc "Virtualizer for x86 and arm64 hardware" homepage "https://www.virtualbox.org/wiki/Testbuilds" livecheck do url :homepage regex(/href=.*?VirtualBox[._-]v?(\d+(?:[.-]\d+)+.*?)[._-]#{arch}\.dmg(?!.+?development)/i) end conflicts_with cask: [ "virtualbox", "virtualbox@6", ] depends_on macos: ">= :catalina" pkg "VirtualBox.pkg", choices: [ { "choiceIdentifier" => "choiceVBoxKEXTs", "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "choiceVBox", "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "choiceVBoxCLI", "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "choiceOSXFuseCore", "choiceAttribute" => "selected", "attributeSetting" => 0, }, ] postflight do # If VirtualBox is installed before `/usr/local/lib/pkgconfig` is created by Homebrew, # it creates it itself with incorrect permissions that break other packages. # See https://github.com/Homebrew/homebrew-cask/issues/68730#issuecomment-534363026 set_ownership "/usr/local/lib/pkgconfig" end uninstall script: { executable: "VirtualBox_Uninstall.tool", args: ["--unattended"], sudo: true, }, pkgutil: "org.virtualbox.pkg.*", delete: "/usr/local/bin/vboximg-mount" zap trash: [ "/Library/Application Support/VirtualBox", "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.virtualbox.app.virtualbox.sfl*", "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.virtualbox.app.virtualboxvm.sfl*", "~/Library/Preferences/org.virtualbox.app.VirtualBox.plist", "~/Library/Preferences/org.virtualbox.app.VirtualBoxVM.plist", "~/Library/Saved Application State/org.virtualbox.app.VirtualBox.savedState", "~/Library/Saved Application State/org.virtualbox.app.VirtualBoxVM.savedState", "~/Library/VirtualBox", ], rmdir: "~/VirtualBox VMs" caveats do kext end end