Skip to content

Commit ddaa7db

Browse files
authored
Merge pull request #993 from gromgit/fix-dir-list
2 parents d983c67 + 93b4ec7 commit ddaa7db

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

install.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ export HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT=1
231231

232232
unset HAVE_SUDO_ACCESS # unset this from the environment
233233

234+
# create paths.d file for /opt/homebrew installs
235+
# (/usr/local/bin is already in the PATH)
236+
if [[ -d "/etc/paths.d" && "${HOMEBREW_PREFIX}" != "/usr/local" && -x "$(command -v tee)" ]]
237+
then
238+
ADD_PATHS_D=1
239+
fi
240+
234241
have_sudo_access() {
235242
if [[ ! -x "/usr/bin/sudo" ]]
236243
then
@@ -618,6 +625,10 @@ echo "${HOMEBREW_PREFIX}/share/man/man1/brew.1"
618625
echo "${HOMEBREW_PREFIX}/share/zsh/site-functions/_brew"
619626
echo "${HOMEBREW_PREFIX}/etc/bash_completion.d/brew"
620627
echo "${HOMEBREW_REPOSITORY}"
628+
if [[ -n "${ADD_PATHS_D-}" ]]
629+
then
630+
echo "/etc/paths.d/homebrew"
631+
fi
621632

622633
# Keep relatively in sync with
623634
# https://github.com/Homebrew/brew/blob/HEAD/Library/Homebrew/keg.rb
@@ -1011,9 +1022,7 @@ ohai "Downloading and installing Homebrew..."
10111022
execute "${HOMEBREW_PREFIX}/bin/brew" "update" "--force" "--quiet"
10121023
) || exit 1
10131024

1014-
# create paths.d file for /opt/homebrew installs
1015-
# (/usr/local/bin is already in the PATH)
1016-
if [[ -d "/etc/paths.d" && "${HOMEBREW_PREFIX}" != "/usr/local" && -x "$(command -v tee)" ]]
1025+
if [[ -n "${ADD_PATHS_D-}" ]]
10171026
then
10181027
execute_sudo "${MKDIR[@]}" /etc/paths.d
10191028
echo "${HOMEBREW_PREFIX}/bin" | execute_sudo tee /etc/paths.d/homebrew

0 commit comments

Comments
 (0)