cask "obs" do arch arm: "Apple", intel: "Intel" livecheck_folder = on_arch_conditional arm: "arm64", intel: "x86_64" version "31.1.1" sha256 arm: "f649fd6ef36ef87d3df0be76c92ea793129bb28a95630e77cb49a3fa5eeec6c3", intel: "cd97a3187f80c891b512203cedca66823972ae8fbb882d6e5b34625e302e2e86" url "https://cdn-fastly.obsproject.com/downloads/OBS-Studio-#{version}-macOS-#{arch}.dmg" name "OBS" desc "Open-source software for live streaming and screen recording" homepage "https://obsproject.com/" livecheck do url "https://obsproject.com/osx_update/updates_#{livecheck_folder}_v2.xml" regex(/obs[._-]studio[._-]v?(\d+(?:\.\d+)+)[._-]macos[._-]#{arch}\.dmg/i) strategy :sparkle do |items, regex| items.map do |item| next if item.channel != "stable" item.url&.[](regex, 1) end end end auto_updates true conflicts_with cask: "obs@beta" depends_on macos: ">= :big_sur" app "OBS.app" # shim script (https://github.com/Homebrew/homebrew-cask/issues/18809) shimscript = "#{staged_path}/obs.wrapper.sh" binary shimscript, target: "obs" preflight do File.write shimscript, <<~EOS #!/bin/bash exec '#{appdir}/OBS.app/Contents/MacOS/OBS' "$@" EOS end uninstall delete: "/Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin" zap trash: [ "~/Library/Application Support/obs-studio", "~/Library/HTTPStorages/com.obsproject.obs-studio", "~/Library/Preferences/com.obsproject.obs-studio.plist", "~/Library/Saved Application State/com.obsproject.obs-studio.savedState", ] end