Search code examples
rubymacosrbenv

OSX Installing Ruby with rbenv


I have installed Ruby on OSX using rbenv following these instructions: https://gorails.com/setup/osx/10.9-mavericks

I installed 2.2.2 however, even after adding it as the global value in rbenv using rbenv global 2.2.2, the ruby -v command still returns ruby 1.8.7.

Now, I know that in my /usr/bin, ruby is still symlinked to the default OSX version (1.8.7). And I could change the symlink. But I'm wondering what the best practice is here, and how rbenv is supposed to work in terms of multiple ruby versions?


Solution

  • Try rbenv rehash, which you should do after installing anything Ruby (or Gem) related.

    Have you added this to .bashrc (or similar for your set up)?

    export RBENV_ROOT=/usr/local/var/rbenv
    if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
    

    and

    PATH=/usr/local/bin:/usr/local/sbin:$PATH