11

I read in rbenv can't change global ruby version that I need to add ~/.rbenv/bin to my PATH for rbenv to work.

That's also mentioned in the rbenv documentation but that directory doesn't exist as shown below:

$ ls -a ~/.rbenv/
.  ..  plugins  shims  version  versions

So why do I need to add a directory that doesn't exist to my path for rbenv to work?

Edit:

@theTinMan, I tried uninstall and reinstalling, but I still don't have a ~/.rbenv/bin path. Where are you seeing in the documentation that it should be there?

$ rbenv --version
rbenv 1.0.0
$ which rbenv
rbenv () {
    local command
    command="$1"
    if [ "$#" -gt 0 ]
    then
        shift
    fi
    case "$command" in
        (rehash | shell) eval "$(rbenv "sh-$command" "$@")" ;;
        (*) command rbenv "$command" "$@" ;;
    esac
}
$ cd
$ ls .rbenv
plugins  shims    version  versions
$ brew list | grep rbenv
rbenv
$
$ brew uninstall rbenv
Uninstalling /usr/local/Cellar/rbenv/1.0.0... (36 files, 61.9K)
rbenv 0.4.0 is still installed.
Remove all versions with `brew uninstall --force rbenv`.
$ brew uninstall --force rbenv
Uninstalling rbenv... (32 files, 49.9K)
$ brew install rbenv 
==> Summary
  /usr/local/Cellar/rbenv/1.0.0: 36 files, 62K
$ ls .rbenv
plugins  shims    version  versions
$ rbenv -v
rbenv 1.0.0
$ rbenv versions
  system
  2.0.0-p648
* 2.3.1 (set by /Users/max/.rbenv/version)
$
mbigras
  • 7,664
  • 11
  • 50
  • 111
  • 1
    Did you install rbenv through Homebrew? If so, the instructions are slightly different, [including a different directory to add to your path](https://github.com/rbenv/rbenv#how-rbenv-hooks-into-your-shell). Running `rbenv init` handles this for you, by the way. – Paul Hoffer Oct 23 '16 at 05:59
  • 2
    A properly installed rbenv will contain a `bin` directory. How did you install rbenv? The [installation directions](https://github.com/rbenv/rbenv) are quite simple. – the Tin Man Oct 23 '16 at 21:15
  • 1
    To those who marked this question off-topic, it isn't. rbenv is a tool used exclusively with Ruby, to manage its installation. Questions about rbenv are handled here on Stack Overflow regularly. – the Tin Man Oct 23 '16 at 21:17
  • @theTinMan, please see edits – mbigras Oct 31 '16 at 03:27

1 Answers1

18

I had the following in my .zshrc

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

But I only needed the bottom line

# export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
mbigras
  • 7,664
  • 11
  • 50
  • 111