Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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)
➜  ~
like image 322
mbigras Avatar asked Oct 23 '16 03:10

mbigras


People also ask

What does Rbenv mean?

rbenv provides support for specifying application-specific versions of Ruby, lets you change the global Ruby for each user, and allows you to use an environment variable to override the Ruby version. In this tutorial, you will use rbenv to install and set up Ruby on Rails on your local macOS machine.

What is Rbenv command?

rbenv is included in all installations of Bitnami Ruby stack that use system packages. It is a command-line tool which allows you to easily install, manage, and work with multiple Ruby environments. Every installed Ruby interpreter using rbenv is isolated in its own directory with its libraries and gems.

What is Rbenv local?

rbenv localSets a local application-specific Ruby version by writing the version name to a . ruby-version file in the current directory. This version overrides the global version, and can be overridden itself by setting the RBENV_VERSION environment variable or with the rbenv shell command.


1 Answers

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 -)"
like image 170
mbigras Avatar answered Oct 17 '22 12:10

mbigras