问题
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