Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a CentOS VM and I need to install the latest version of Ruby on it. Unfortunately, yum only makes Ruby 1.8.6 available so I'm trying to install Ruby from source. Here's what I'm using:

cd /usr/src
sudo -s
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125
make && make install

The problem is that once that's done, I can only use Ruby as a regular user but I need to use it as root to install some gems. For example, as a regular user I can do ruby -v and it works but sudo ruby -v outputs bash: ruby: command not found.

What am I missing to make stuff I install from source available to all users?

share|improve this question
You don't need to be root to install gems. – womble Apr 5 '12 at 16:00
I swear I tried to install a gem and got a Permission Denied. Maybe my mind is blurred by sheer frustration though. – pwny Apr 5 '12 at 16:14
You may have to explain to rubygems that you want to put gems in your homedir (by setting something-or-other in your .gemrc file, or perhaps setting GEM_HOME), but whenever I've run gem as an ordinary user, it's done the right thing and dropped them into ~/.gem. – womble Apr 5 '12 at 16:49
up vote 2 down vote accepted

For Ruby specifically, you want to use RVM -- it makes the whole thing so much easier.

In general, though, if a piece of software you've built and installed isn't available to all users, then the problem is most likely that it hasn't been installed to somewhere in the stock PATH. That's pretty rare these days, because most build systems are smart enough not to do that, but if somehow you've managed to get it confused, you'll need to set it straight. That's build-system specific, but if it's following the autoconf conventions, adding --prefix=/usr/local will usually do the trick. Otherwise, hie thee to the documentation for how to tell a particular program how to install to somewhere sensible.

share|improve this answer
RVM made my day. You sir are a god among men. – pwny Apr 5 '12 at 16:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.