I intend to use Ruby when programming my Raspberry Pi which is running the Debian based Occidentals. Via SSH, I executed:
curl -L https://get.rvm.io | bash -s stable --ruby
which downloaded the ruby source and compiled it. It tool about 2 hours to complete. I would like to use ruby via AdaFruit's WebIDE – http://learn.adafruit.com/webide/. However, the ruby installation I performed via SSH created a folder called .rvm
in the pi
user's directory, whereas the WebIDE uses the webide
user account.
What is the best way to allow the webide
user account access to ruby? I tried moving the .rvm
folder from /home/pi
to /etc/share
, but this didn't work – when trying to use ruby at a terminal I got the error "ERROR: Missing RVM environment file: '/home/pi/.rvm/environments/ruby-2.0.0-p353'" so I must've broken some link.
I'm holding back running another 2hr install for the webide user as I'm sure there's a better way!
Best Answer
Don't dismiss RVM's value
You can use the repository version of Ruby but I would recommend going another way and using RVM to manage Ruby. I realize it might seem like it's slowing you down, but the version of Ruby that's deployed via the repositories though usable will often lead to problems down the road. It's generally best to create dedicated versions of interpreters and any required libraries (Gems) that can be dedicated to a particular application and/or use case.
RVM provides the ability to install for single user (which is what you did) as well as do a multi-user installation.
Running the installation this way will automatically trigger RVM to do a multi-user installation which will install the software under
/usr/local/rvm
. From here the software can be accessed by anyone that's in the Unix grouprvm
.Where
<user>
would be the userwebide
.Installing a Ruby
Now add the following to each user's
$HOME/.bashrc
. I generally put this at the end of the file:With that, you'll want to logout and log back in.
NOTE1: It isn't enough to start another tab in gnome-terminal, it needs to be a newly logged in session. This is so that the group you just added this user to, get's picked up.
NOTE2: You'll probably not have to add the above to your
$HOME/.bashrc
if you find you have the following file installed here already, this does the above plus more for all users that are in the grouprvm
on the system.Once logged in you'll need to install a Ruby. You can do this using the following steps, as user
webide
.What versions available to install?
NOTE: The 1st time you install a Ruby you should do this with a user that has
sudo
rights so that dependencies can be installed. For example on Ubuntu, you'll see this type of activity. After these are installed other users, such aswebide
, should be able to install additional Rubies too, into the directory/usr/local/rvm
.Viewing installed versions
Installing a 2nd Ruby
Now when we list what's installed:
From the above we can see that user
webide
was able to install a Ruby.Setting a default for all rvm users
Logging in as another user that's in the group
rvm
we can see the effects of makingruby-2.0.0-p195
the default.So this user is using,
ruby-1.9.3-p484
, and he's now configured to useruby-2.0.0-p195
as the default too.Slow downloads/installs
If you're experiencing a slow download you might want to make use of the offline installation method instead. This will allow you to do a re-install later on. Or perhaps the download via this system is problematic, and you could download the RVM installer on one system, and then use
scp
to copy the installer to this system afterwards.See here, RVM in offline mode for full details.
References