0

I recently updated my ruby version for the first time since installing rbenv. On my development machine I discovered that I needed to reinstall bundler and all my gems again for each application using bundle install.

Now, when I login to my production server I notice that I have a ruby-build directory in my home folder at ~/ruby-build and in .rbenv/plugins. How can I find out which one my server is using and so which one to run git pull and install the new version of ruby? Can I just delete the directory at ~/ruby-build and deal with the other? Doing some exploring I find I also have a ruby-build in usr/local/bin on my server but this is not a directory.

I am completely confused by all of this. Rbenv lives in my home directory, rather than in any system directory on the server. Does this matter? How does it still work on a server even if I am not logged in?

Running rbenv versions from my home directory on the server reports "The program 'rbenv' is currently not installed" but lists the versions installed on my development laptop.

My .bashrc on the sever contains this entry at the top

if [ -d "${RBENV_ROOT}" ]; then
  export PATH="${RBENV_ROOT}/bin:${PATH}"
  eval "$(rbenv init -)"
fi

My .bashrc on my development laptop contains this entry at the bottom.

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
markhorrocks
  • 1,199
  • 19
  • 82
  • 151

1 Answers1

0

Since you include that in your .bashrc, I imagine that if you were to echo $RBENV_ROOT in the terminal you'll find out which rbenv directory is the one being used.

Although, you say that the rbenv command doesn't work so perhaps $RBENV_ROOT is not defined. In that case, you can simply do something like RBENV_ROOT=$HOME/.rbenv/ before that conditional -- or whatever you like -- to set the rbenv directory it should use.

When you do that, to define $RBENV_ROOT, re-login to make the changes take effect, or re-source the .bashrc file with source ~/.bashrc.

Jorge Israel Peña
  • 36,800
  • 16
  • 93
  • 123
  • For my server,can I just use the entry in .bashrc as per my dev laptop rather than define RBENV_ROOT at all? Is there any difference or do I need RBENV_ROOT because I want it on a server? – markhorrocks Jan 29 '13 at 03:36
  • specifically, I need to know the differences involved in setting rbenv up on a server rather than a local dev machine. – markhorrocks Jan 29 '13 at 03:44
  • There are no differences. I only mentioned doing it through RBENV_ROOT because that's what you have, so I figured that's how you wanted it. You can just as well set it up the same as on your laptop. If it doesn't work that way then there's something about the server's environment which prevents it, which you're not divulging. Worth a try I suppose. – Jorge Israel Peña Jan 29 '13 at 10:56
  • Just one more thing, for some reason i have ruby-build in my home dir on the server at ~/ruby-build. Should I just delete that and use the also existing ruby-build at .rbenv/plugins/ruby-build? – markhorrocks Jan 29 '13 at 14:45
  • It's usually placed in .rbenv/plugins, so yeah if you want, I guess the one in ~ isn't used. – Jorge Israel Peña Jan 30 '13 at 10:39