Homebrew 使用 Ruby 脚本(称为 Formula)来定义每个软件包的安装过程。一个 Formula 文件通常包含了软件包的名称、版本、来源、依赖关系以及安装方法等信息。
Cask
# 定义一个 cask 包,名称为 "steam"
cask "steam" doversion "4.0" # 包版本为 4.0sha256 :no_check # 不检查下载文件的 SHA-256 校验和# 指定包下载 URL,并验证来源域名url "https://cdn.cloudflare.steamstatic.com/client/installer/steam.dmg",verified: "cdn.cloudflare.steamstatic.com/"name "Steam" # 包名称desc "Video game digital distribution service" # 包描述homepage "https://store.steampowered.com/about/" # 包主页链接# 定义包的更新检查策略livecheck dourl :url # 使用下载 URL 检查更新strategy :extract_plist # 从 Plist 文件中提取版本信息endauto_updates true # 指定包支持自动更新app "Steam.app" # 指定要安装的应用程序uninstall launchctl: [ # 定义卸载时要停止的服务"com.valvesoftware.steam.ipctool","com.valvesoftware.steamclean",],quit: [ # 定义卸载时要退出的进程"com.valvesoftware.steam","com.valvesoftware.steam.helper","com.valvesoftware.steam.helper.EH",],delete: "~/Library/Application Support/Steam/Steam.AppBundle" # 指定要删除的应用支持目录zap trash: [ # 定义清理时要删除的残留数据"~/Library/Application Support/Steam/","~/Library/LaunchAgents/com.valvesoftware.steamclean.plist","~/Library/Preferences/com.valvesoftware.steam.helper.plist","~/Library/Saved Application State/com.valvesoftware.steam.savedState/",]caveats dorequires_rosetta # 提示该应用需要 Rosetta 翻译环境end
end