MacOS fixes

This commit is contained in:
MangoPig
2026-06-01 00:34:54 +01:00
parent 52054493cc
commit 12b752892b
3 changed files with 26 additions and 4 deletions

View File

@@ -46,7 +46,7 @@ detect_arch() {
install_tool() {
local tool="$1"
local platform arch version owner repo asset binary_rel formula url tmp_dir archive_path extracted_path target_path installed_path
local platform arch version owner repo asset binary_rel formula url tmp_dir archive_path extracted_path target_path installed_path formula_prefix
platform="$(detect_platform)"
arch="$(detect_arch)"
@@ -74,7 +74,13 @@ install_tool() {
printf '%s already installed via Homebrew\n' "$tool"
fi
installed_path="$(command -v "$tool" || true)"
formula_prefix="$(brew --prefix "$formula" 2>/dev/null || true)"
if [ -n "$formula_prefix" ] && [ -x "$formula_prefix/bin/$tool" ]; then
installed_path="$formula_prefix/bin/$tool"
else
installed_path="$(command -v "$tool" || true)"
fi
if [ -z "$installed_path" ]; then
printf 'Installed formula %s but %s is not on PATH\n' "$formula" "$tool" >&2
exit 1