From a70f444255b9de9c33ddea5a451f5ed684cc92c7 Mon Sep 17 00:00:00 2001 From: Jakub Kuczys Date: Thu, 13 Apr 2023 18:48:47 +0200 Subject: [PATCH] Add `brew shellenv` to shell profile in macOS install guide (#5993) --- 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 b3c44e32f..f06cc6b00 100644 --- a/docs/install_guides/mac.rst +++ b/docs/install_guides/mac.rst @@ -17,6 +17,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: @@ -33,9 +36,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.11/bin:$PATH"' >> "$profile" - source "$profile" + echo 'export PATH="$(brew --prefix)/opt/python@3.11/bin:$PATH"' >> "$([ -n "$ZSH_VERSION" ] && echo ~/.zprofile || ([ -f ~/.bash_profile ] && echo ~/.bash_profile || echo ~/.profile))" + export PATH="$(brew --prefix)/opt/python@3.11/bin:$PATH" .. Include common instructions: