Skip to content

Commit 5585534

Browse files
authored
Merge pull request #988 from Homebrew/paths_d_homebrew
2 parents 6eaf4c5 + 38a0dc3 commit 5585534

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

install.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,14 @@ ohai "Downloading and installing Homebrew..."
10091009
execute "${HOMEBREW_PREFIX}/bin/brew" "update" "--force" "--quiet"
10101010
) || exit 1
10111011

1012-
if [[ ":${PATH}:" != *":${HOMEBREW_PREFIX}/bin:"* ]]
1012+
# create paths.d file for /opt/homebrew installs
1013+
# (/usr/local/bin is already in the PATH)
1014+
if [[ -d "/etc/paths.d" && "${HOMEBREW_PREFIX}" != "/usr/local" && -x "$(command -v tee)" ]]
1015+
then
1016+
execute_sudo "${MKDIR[@]}" /etc/paths.d
1017+
echo "${HOMEBREW_PREFIX}/bin" | execute_sudo tee /etc/paths.d/homebrew
1018+
execute_sudo "${CHOWN[@]}" root:wheel /etc/paths.d/homebrew
1019+
elif [[ ":${PATH}:" != *":${HOMEBREW_PREFIX}/bin:"* ]]
10131020
then
10141021
warn "${HOMEBREW_PREFIX}/bin is not in your PATH.
10151022
Instructions on how to configure your shell for Homebrew

uninstall.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ fi
329329
fi
330330
echo "${HOMEBREW_CELLAR}"
331331
echo "${HOMEBREW_PREFIX}/Caskroom"
332+
echo "/etc/paths.d/homebrew"
332333

333334
[[ -n ${opt_skip_cache_and_logs} ]] || cat <<-EOS
334335
${HOME}/Library/Caches/Homebrew

0 commit comments

Comments
 (0)