【问题标题】:Why do I need to add ~/.rbenv/bin to my path?为什么我需要将 ~/.rbenv/bin 添加到我的路径中?
【发布时间】:2017-03-05 02:15:03
【问题描述】:

我在“rbenv can't change global ruby version”中读到,我需要将 ~/.rbenv/bin 添加到我的 PATH 以使 rbenv 工作。

documentation 中也提到过,但该目录不存在,如下所示:

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

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

编辑:

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

➜  ~/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)
➜  ~

【问题讨论】:

  • 您是否通过 Homebrew 安装了 rbenv?如果是这样,说明会略有不同,including a different directory to add to your path。顺便说一句,运行 rbenv init 会为您处理这个问题。
  • 正确安装的 rbenv 将包含一个 bin 目录。你是如何安装 rbenv 的? installation directions 非常简单。
  • 对于那些将此问题标记为离题的人,事实并非如此。 rbenv 是一个专门用于 Ruby 的工具,用于管理其安装。 Stack Overflow 会定期处理有关 rbenv 的问题。
  • @theTinMan,请查看编辑

标签: ruby bash path rbenv


【解决方案1】:

我的.zshrc 中有以下内容

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

但我只需要底线

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

【讨论】:

    猜你喜欢
    • 2021-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-25
    • 2011-07-02
    • 1970-01-01
    • 2011-08-09
    相关资源
    最近更新 更多