From 73a4a673fe288f7b7b00dc71d0dfa691f90c383f Mon Sep 17 00:00:00 2001 From: David Helkowski Date: Fri, 23 Jan 2026 00:13:25 +0900 Subject: [PATCH] Enhance install_brew_deps.sh with Brewfile support check and error handling This commit adds a check for the availability of `brew bundle` in the `install_brew_deps.sh` script, ensuring that users are informed to update Homebrew if the command is missing. Additionally, the `macdeploycheck` formula is updated to correct the path for the script installation, aligning it with the tapped repository structure. These changes improve the robustness and user experience during the installation of Homebrew dependencies. --- Formula/macdeploycheck.rb | 2 +- build_tools/macos/install_brew_deps.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Formula/macdeploycheck.rb b/Formula/macdeploycheck.rb index de0d5b5e9..174f9a93f 100644 --- a/Formula/macdeploycheck.rb +++ b/Formula/macdeploycheck.rb @@ -4,7 +4,7 @@ class Macdeploycheck < Formula version "0.1.0" # Homebrew requires a URL stanza. Use the script shipped in this tap (file://), # so installs always match the tapped revision. - url "file://#{File.expand_path("../../dist/macos/macdeploycheck.sh", __dir__)}" + url "file://#{File.expand_path("../dist/macos/macdeploycheck.sh", __dir__)}" sha256 :no_check license "MIT" diff --git a/build_tools/macos/install_brew_deps.sh b/build_tools/macos/install_brew_deps.sh index 878b8f0c7..1095825d1 100755 --- a/build_tools/macos/install_brew_deps.sh +++ b/build_tools/macos/install_brew_deps.sh @@ -56,6 +56,18 @@ if ! command -v brew >/dev/null 2>&1; then exit 1 fi +# Brewfile support (`brew bundle`) is built into modern Homebrew. The historical +# tap `homebrew/bundle` has been deprecated and may be empty on newer Homebrew. +# If `brew bundle` is missing, the fix is to update Homebrew itself. +if ! brew bundle --help >/dev/null 2>&1; then + run_with_heartbeat "Updating Homebrew (required for 'brew bundle')" bash -lc "brew update" + if ! brew bundle --help >/dev/null 2>&1; then + echo "Error: This Homebrew installation does not provide 'brew bundle'." >&2 + echo "Update Homebrew (e.g. 'brew update') or reinstall Homebrew, then re-run this script." >&2 + exit 1 + fi +fi + # Homebrew taps are git clones; local formula changes must be committed to be visible. if command -v git >/dev/null 2>&1 && git -C "$repo_root" rev-parse --is-inside-work-tree >/dev/null 2>&1; then if git -C "$repo_root" status --porcelain Formula/ | grep -q .; then