Skip to content

Commit

Permalink
bin/brew: fix prioritisation of system env files
Browse files Browse the repository at this point in the history
Fixes #18925.
  • Loading branch information
carlocab committed Dec 12, 2024
1 parent 9783ab0 commit 2a3169d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/brew
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ export_homebrew_env_file() {
}

# First, load the system-wide configuration.
export_homebrew_env_file "/etc/homebrew/brew.env"

unset SYSTEM_ENV_TAKES_PRIORITY
if [[ -n "${HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY-}" ]]
then
SYSTEM_ENV_TAKES_PRIORITY="1"
else
export_homebrew_env_file "/etc/homebrew/brew.env"
fi

# Next, load the prefix configuration
Expand All @@ -152,7 +152,7 @@ fi

export_homebrew_env_file "${HOMEBREW_USER_CONFIG_HOME}/brew.env"

# If the system configuration takes priority, load it last.
# If the system configuration takes priority, load it again to override any previous settings.
if [[ -n "${SYSTEM_ENV_TAKES_PRIORITY-}" ]]
then
export_homebrew_env_file "/etc/homebrew/brew.env"
Expand Down

0 comments on commit 2a3169d

Please sign in to comment.