Merge pull request #20159 from Homebrew/paths_d_homebrew

package/scripts/postinstall: add Homebrew to PATH.
This commit is contained in:
Patrick Linnane 2025-06-24 20:27:16 +00:00 committed by GitHub
commit 2c89b70f28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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