Seybo Glaux Seybo Glaux - 7 months ago 17
Ruby Question

Other user doesn't see Ruby installation

I have installed Ruby on my Ubuntu 14.04 server under the root account with rbenv.

root@droplet:~# ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [i686-linux]


But if I log in under another user I get this message after the same command:

The program 'ruby' can be found in the following packages:
* ruby
* ruby1.8


Why doesn't another user ee ruby installation? And how can I fix it?

I'm a complete newbie to it and I may have missed something important. So tell me if you want me to provide any other info on this matter.

Answer

To install Ruby with rbenv so that all users on a machine can use it, you need to

  • install rbenv in a public place, e.g. /usr/local/rbenv
  • set up rbenv for each user in a shell startup file, e.g. /etc/profile:

    export RBENV_ROOT=/usr/local/rbenv
    export PATH="$RBENV_ROOT/bin:$PATH"
    eval "$(rbenv init -)"
    

A blog post by Blake Williams gives details.