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

旧城冷巷雨未停 提交于 2020-01-14 14:29:07

问题


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

It's also mentioned in the 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've 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?

➜  ~/D/w/t/underline-test  rbenv --version
rbenv 1.0.0
➜  ~/D/w/t/underline-test  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
}
➜  ~/D/w/t/underline-test  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)
➜  ~

回答1:


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


来源:https://stackoverflow.com/questions/40199156/why-do-i-need-to-add-rbenv-bin-to-my-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!