ruby - 为什么我需要将 ~/.rbenv/bin 添加到我的路径中?

标签 ruby bash path rbenv

我读入了rbenv can't change global ruby version我需要将 ~/.rbenv/bin 添加到我的 PATH 中,rbenv 才能工作。

rbenv documentation 中也提到了这一点但该目录不存在,如下所示:

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

那么为什么我需要添加一个不存在于我的路径中的目录才能使 rbenv 工作?

编辑:

@theTinMan,我尝试卸载并重新安装,但我仍然没有 ~/.rbenv/bin 路径。您在文档中的什么地方看到它应该在那里?

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

最佳答案

我的 .zshrc 中有以下内容

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

但我只需要底线

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

关于ruby - 为什么我需要将 ~/.rbenv/bin 添加到我的路径中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40199156/

相关文章:

c - 我怎样才能获得所有文件的列表及其在c中的路径

ruby - 了解字节解包

ruby-on-rails - 使用 Ruby on Rails 访问 Google Drive API v3

bash - 使用 &(在 bash 中)创建进程并终止它们是如何工作的?

linux - 在路径中插入变量(bash 命令行)

java - 将 URL 转换为路径而不抛出异常

ruby - Ruby & Rails 中的大括号 : [Brackets],(圆括号)和 {Curlies}

ruby - mechanize 是 Ruby 中最流行的自动化网站交互库之一吗?

bash后台进程修改全局变量

c++ - MFC等价于Java File#isDirectory()