From 5c1a6998b71215f7c85bfd95628b789f6aa06934 Mon Sep 17 00:00:00 2001 From: "T. R. Bernstein" <137705289+trbernstein@users.noreply.github.com> Date: Thu, 16 Oct 2025 23:21:29 +0200 Subject: [PATCH] Adapt homebrew installation for macOS on Intel --- modules/04-install-brew.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/04-install-brew.sh b/modules/04-install-brew.sh index c2c7182..85ef05f 100755 --- a/modules/04-install-brew.sh +++ b/modules/04-install-brew.sh @@ -96,8 +96,12 @@ function getHomebrewRepositoryPath() { function createBrewCallerScript() { ensureLocalBinFolder + local uname_machine=$(/usr/bin/uname -m) local username=${homebrew_username} - local brewCallerPath="/usr/local/bin/brew" + local homebrewRepositoryPath="$(getHomebrewRepositoryPath)" + local brewCallerPath="${homebrewRepositoryPath}/bin/brew-caller" + local brewCallerSymlink="/usr/local/bin/brew" + [[ ${uname_machine} == "arm64" ]] && brewCallerPath="${brewCallerSymlink}" [ -f "${brewCallerPath}" ] && rm "${brewCallerPath}" cat <<- BREWCALLER > ${brewCallerPath} #!/usr/bin/env zsh @@ -114,10 +118,11 @@ function createBrewCallerScript() { export HOMEBREW_NO_ANALYTICS_THIS_RUN=1 export HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT=1 umask 002 - "$(getHomebrewRepositoryPath)/bin/brew" "\$@" + "${homebrewRepositoryPath}/bin/brew" "\$@" BREWCALLER chown root:admin ${brewCallerPath} chmod ug+x,o-x ${brewCallerPath} + [[ ${uname_machine} == "arm64" ]] || ln -s "${brewCallerPath}" "${brewCallerSymlink}" } function createBrewPeriodicScript() {