From 9dab0af11f22f91c98a77892a14b16ca7fa7fbb4 Mon Sep 17 00:00:00 2001 From: Nicolas Cavigneaux Date: Mon, 6 Nov 2017 15:43:03 +0100 Subject: [PATCH] Set RBENV_ROOT to "$HOME/.rbenv" if not already set (#6324) This is the default behavior of rbenv and what users are expecting most of the time. It allows users to have their own set of rubies and gems. It also prevents losing all rubies when rbenv is updated using Homebrew which is not true when RBENV_ROOT is set to /usr/local/opt/rbenv. --- plugins/rbenv/rbenv.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh index ef5106f2..7430e962 100644 --- a/plugins/rbenv/rbenv.plugin.zsh +++ b/plugins/rbenv/rbenv.plugin.zsh @@ -7,6 +7,9 @@ rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv" if _homebrew-installed && rbenv_homebrew_path=$(brew --prefix rbenv 2>/dev/null); then rbenvdirs=($rbenv_homebrew_path "${rbenvdirs[@]}") unset rbenv_homebrew_path + if [[ $RBENV_ROOT = '' ]]; then + RBENV_ROOT="$HOME/.rbenv" + fi fi for rbenvdir in "${rbenvdirs[@]}" ; do