From 25a2655d44743af9713bb1dd175e4cb31e03acb4 Mon Sep 17 00:00:00 2001 From: geekrebel Date: Thu, 16 Apr 2026 13:04:28 +0200 Subject: [PATCH] Replacing the hard-coded /usr/local/Cellar/python@3.7/3.7.9_2/... PATH in installer/build-mac-dmg.sh with Homebrew-prefix detection, so the script runs on both Apple Silicon (/opt/homebrew) and Intel (/usr/local) Macs. The removed entries (the Python 3.7 Cellar path and /usr/local/qt5/5.5/clang_64/bin) are unused by this script: grep confirms it never invokes python, qmake, or any Qt tool. On Intel Macs the effective PATH is unchanged (BREW_PREFIX resolves to /usr/local). If brew is not installed we fall back to /usr/local, preserving the previous default. This also resolves the existing "XXX: These paths should be set using `brew prefix` commands" TODO comment that was already in the file. Co-Authored-By: Claude Opus 4.6 (1M context) --- installer/build-mac-dmg.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/installer/build-mac-dmg.sh b/installer/build-mac-dmg.sh index 1f6ab38474..45e5130f66 100644 --- a/installer/build-mac-dmg.sh +++ b/installer/build-mac-dmg.sh @@ -1,8 +1,15 @@ #!/bin/sh -# XXX: These paths should be set using `brew prefix` commands, -# for future-proofing against upgrades -PATH=/usr/local/Cellar/python@3.7/3.7.9_2/Frameworks/Python.framework/Versions/3.7/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/qt5/5.5/clang_64/bin:/opt/X11/bin +# Detect Homebrew prefix so this script works on both Apple Silicon +# (/opt/homebrew) and Intel (/usr/local) Macs without hard-coded paths. +if [ -x /opt/homebrew/bin/brew ]; then + BREW_PREFIX="$(/opt/homebrew/bin/brew --prefix)" +elif [ -x /usr/local/bin/brew ]; then + BREW_PREFIX="$(/usr/local/bin/brew --prefix)" +else + BREW_PREFIX="/usr/local" +fi +PATH="${BREW_PREFIX}/bin:${BREW_PREFIX}/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" MAC_NOTARIZE_PASSWORD=$1 # Get Version