File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,13 @@ export HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT=1
231
231
232
232
unset HAVE_SUDO_ACCESS # unset this from the environment
233
233
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
+
234
241
have_sudo_access () {
235
242
if [[ ! -x " /usr/bin/sudo" ]]
236
243
then
@@ -618,6 +625,10 @@ echo "${HOMEBREW_PREFIX}/share/man/man1/brew.1"
618
625
echo " ${HOMEBREW_PREFIX} /share/zsh/site-functions/_brew"
619
626
echo " ${HOMEBREW_PREFIX} /etc/bash_completion.d/brew"
620
627
echo " ${HOMEBREW_REPOSITORY} "
628
+ if [[ -n " ${ADD_PATHS_D-} " ]]
629
+ then
630
+ echo " /etc/paths.d/homebrew"
631
+ fi
621
632
622
633
# Keep relatively in sync with
623
634
# https://github.com/Homebrew/brew/blob/HEAD/Library/Homebrew/keg.rb
@@ -1011,9 +1022,7 @@ ohai "Downloading and installing Homebrew..."
1011
1022
execute " ${HOMEBREW_PREFIX} /bin/brew" " update" " --force" " --quiet"
1012
1023
) || exit 1
1013
1024
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-} " ]]
1017
1026
then
1018
1027
execute_sudo " ${MKDIR[@]} " /etc/paths.d
1019
1028
echo " ${HOMEBREW_PREFIX} /bin" | execute_sudo tee /etc/paths.d/homebrew
You can’t perform that action at this time.
0 commit comments