Search code examples
rubybashpathrbenv

Why do I need to add ~/.rbenv/bin to my path?


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)
$

Solution

  • 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 -)"