cask "libreoffice" do arch arm: "aarch64", intel: "x86-64" folder = on_arch_conditional arm: "aarch64", intel: "x86_64" version "24.8.3" sha256 arm: "66f853ed8a7e1c402ae331cc3c0457a0fe6c3cba764054a6ff208cd0801f0140", intel: "58a5fd80f4b33741127ff68d90a0eaaa68bd329429bf5b184ca9261f3b692639" url "https://download.documentfoundation.org/libreoffice/stable/#{version}/mac/#{folder}/LibreOffice_#{version}_MacOS_#{arch}.dmg", verified: "download.documentfoundation.org/libreoffice/stable/" name "LibreOffice" desc "Free cross-platform office suite, fresh version" homepage "https://www.libreoffice.org/" livecheck do url "https://download.documentfoundation.org/libreoffice/stable/" regex(%r{href=["']v?(\d+(?:\.\d+)+)/?["' >]}i) end conflicts_with cask: "libreoffice-still" depends_on macos: ">= :catalina" app "LibreOffice.app" binary "#{appdir}/LibreOffice.app/Contents/MacOS/gengal" binary "#{appdir}/LibreOffice.app/Contents/MacOS/regview" binary "#{appdir}/LibreOffice.app/Contents/MacOS/senddoc" binary "#{appdir}/LibreOffice.app/Contents/MacOS/uno" binary "#{appdir}/LibreOffice.app/Contents/MacOS/unoinfo" binary "#{appdir}/LibreOffice.app/Contents/MacOS/unopkg" binary "#{appdir}/LibreOffice.app/Contents/MacOS/uri-encode" binary "#{appdir}/LibreOffice.app/Contents/MacOS/xpdfimport" # shim script (https://github.com/Homebrew/homebrew-cask/issues/18809) shimscript = "#{staged_path}/soffice.wrapper.sh" binary shimscript, target: "soffice" preflight do File.write shimscript, <<~EOS #!/bin/sh '#{appdir}/LibreOffice.app/Contents/MacOS/soffice' "$@" EOS end zap trash: [ "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.libreoffice.script.sfl*", "~/Library/Application Support/LibreOffice", "~/Library/Preferences/org.libreoffice.script.plist", "~/Library/Saved Application State/org.libreoffice.script.savedState", ] end