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?

I swear I tried to install a gem and got a Permission Denied. Maybe my mind is blurred by sheer frustration though.
–
pwnyApr 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.
–
wombleApr 5 '12 at 16:49

1 Answer
1

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.