From a9faa2cd8e8ec05baa638ea123c407292732234e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 23 Jun 2025 15:16:49 +0100 Subject: [PATCH] package/scripts/postinstall: add Homebrew to PATH. This is automatic for `/usr/local/bin/brew` but let's do it manually for `/opt/homebrew/bin/brew` too. --- package/scripts/postinstall | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/package/scripts/postinstall b/package/scripts/postinstall index dc83014913..b194590df9 100755 --- a/package/scripts/postinstall +++ b/package/scripts/postinstall @@ -93,3 +93,12 @@ mkdir -vp "${user_api_cache_dir}" mv -v "${homebrew_directory}/cache_api/"* "${user_api_cache_dir}" chown -R "${homebrew_pkg_user}:staff" "${user_cache_dir}" rm -vrf "${homebrew_directory}/cache_api" + +# create paths.d file for /opt/homebrew installs +# (/usr/local/bin is already in the PATH) +if [[ -d "/etc/paths.d" && "${homebrew_directory}" == "/opt/homebrew" ]] +then + mkdir -vp /etc/paths.d + echo "/opt/homebrew/bin" >/etc/paths.d/homebrew + chown root:wheel /etc/paths.d/homebrew +fi