diff --git a/docs/install_guides/_includes/_install-pyenv-and-setup-path.rst b/docs/install_guides/_includes/_install-pyenv-and-setup-path.rst new file mode 100644 index 000000000..b3f0f4d38 --- /dev/null +++ b/docs/install_guides/_includes/_install-pyenv-and-setup-path.rst @@ -0,0 +1,19 @@ +To install/update pyenv, run the following command: + +.. prompt:: bash + + command -v pyenv && pyenv update || curl https://pyenv.run | bash + +After this command, you will see a warning about 'pyenv' not being in the load path. To address this, +you should run these commands: + +.. prompt:: bash + + profile=$([ -n "$ZSH_VERSION" ] && echo ~/.zprofile || ([ -f ~/.bash_profile ] && echo ~/.bash_profile || echo ~/.profile)) + rcfile=$([ -n "$ZSH_VERSION" ] && echo ~/.zshrc || echo ~/.bashrc) + printf '%s\n%s\n%s\n' 'export PYENV_ROOT="$HOME/.pyenv"' 'export PATH="$PYENV_ROOT/bin:$PATH"' "$([ -f "$profile" ] && cat "$profile")" > "$profile" + echo 'eval "$(pyenv init --path)"' >> "$profile" + echo 'eval "$(pyenv init -)"' >> "$rcfile" + echo 'eval "$(pyenv virtualenv-init -)"' >> "$rcfile" + +Then **log out and log back in** and run the following command: diff --git a/docs/install_guides/_includes/install-python-pyenv.rst b/docs/install_guides/_includes/install-python-pyenv.rst index c020ee468..f05aa5517 100644 --- a/docs/install_guides/_includes/install-python-pyenv.rst +++ b/docs/install_guides/_includes/install-python-pyenv.rst @@ -6,14 +6,7 @@ On distributions where Python 3.9 needs to be compiled from source, we recommend This simplifies the compilation process and has the added bonus of simplifying setting up Red in a virtual environment. -.. prompt:: bash - - command -v pyenv && pyenv update || curl https://pyenv.run | bash - -**After this command, you may see a warning about 'pyenv' not being in the load path. Follow the -instructions given to fix that, then close and reopen your shell.** - -Then run the following command: +.. include:: _includes/_install-pyenv-and-setup-path.rst .. prompt:: bash diff --git a/docs/install_guides/_includes/install-python38-pyenv.rst b/docs/install_guides/_includes/install-python38-pyenv.rst index ae72c622b..f48314868 100644 --- a/docs/install_guides/_includes/install-python38-pyenv.rst +++ b/docs/install_guides/_includes/install-python38-pyenv.rst @@ -6,14 +6,7 @@ On distributions where Python 3.8 needs to be compiled from source, we recommend This simplifies the compilation process and has the added bonus of simplifying setting up Red in a virtual environment. -.. prompt:: bash - - command -v pyenv && pyenv update || curl https://pyenv.run | bash - -**After this command, you may see a warning about 'pyenv' not being in the load path. Follow the -instructions given to fix that, then close and reopen your shell.** - -Then run the following command: +.. include:: _includes/_install-pyenv-and-setup-path.rst .. prompt:: bash diff --git a/docs/install_guides/mac.rst b/docs/install_guides/mac.rst index d2c07d5cc..e5c49d075 100644 --- a/docs/install_guides/mac.rst +++ b/docs/install_guides/mac.rst @@ -22,11 +22,18 @@ one-by-one: .. prompt:: bash brew install python@3.9 - echo 'export PATH="$(brew --prefix)/opt/python@3.9/bin:$PATH"' >> ~/.profile - source ~/.profile brew install git brew install --cask adoptopenjdk/openjdk/adoptopenjdk11 +By default, Python installed through Homebrew is not added to the load path. +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" + .. Include common instructions: .. include:: _includes/create-env-with-venv.rst