From a6009c7a3a06ad41f9c2fda815ea90421939ec69 Mon Sep 17 00:00:00 2001 From: Jakub Kuczys Date: Thu, 20 Apr 2023 00:30:05 +0200 Subject: [PATCH] [3.4] Add `brew shellenv` to shell profile in macOS install guide (#5993) (#6071) --- docs/install_guides/mac.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/install_guides/mac.rst b/docs/install_guides/mac.rst index c5faf1ff3..38594c1ed 100644 --- a/docs/install_guides/mac.rst +++ b/docs/install_guides/mac.rst @@ -15,6 +15,9 @@ following, then press Enter: .. prompt:: bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + brew_location="$([ -n "$HOMEBREW_PREFIX" ] && echo "$HOMEBREW_PREFIX" || ([ "$(/usr/bin/uname -m)" = "arm64" ] && echo /opt/homebrew || echo /usr/local))/bin/brew" + printf '\neval "$(%s shellenv)"\n' "$brew_location" >> "$([ -n "$ZSH_VERSION" ] && echo ~/.zprofile || ([ -f ~/.bash_profile ] && echo ~/.bash_profile || echo ~/.profile))" + eval "$("$brew_location" shellenv)" After the installation, install the required packages by pasting the commands and pressing enter, one-by-one: @@ -31,9 +34,8 @@ To fix this, you should run these commands: .. prompt:: bash - profile=$([ -n "$ZSH_VERSION" ] && echo ~/.zprofile || ([ -f ~/.bash_profile ] && echo ~/.bash_profile || echo ~/.profile)) - echo 'export PATH="$(brew --prefix)/opt/python@3.9/bin:$PATH"' >> "$profile" - source "$profile" + echo 'export PATH="$(brew --prefix)/opt/python@3.9/bin:$PATH"' >> "$([ -n "$ZSH_VERSION" ] && echo ~/.zprofile || ([ -f ~/.bash_profile ] && echo ~/.bash_profile || echo ~/.profile))" + export PATH="$(brew --prefix)/opt/python@3.9/bin:$PATH" .. Include common instructions: