I need two different versions of ruby on a server. The packaged ruby for the packaged puppet to work, and a compiled ruby for a rails web app to work. So basically I want the default ruby to be the ruby from the package, and for rails to use the compiled ruby (in /usr/local/bin/
and /usr/local/lib/
)
I've found references to setting the RUBYPATH and RUBYLIB environment variables, but I'm confused as to where to set them. In .bashrc
, .profile
, in the apache config somewhere?
One trick would be to munge the PATH to include the one you want first. That is likely a hack though.
If you are using Rails 2.x (which I assume you are) you can specifically run things with a path there, such as:
(for development mode for example.)
If you are using something like Phusion Passenger, which I personally recommend, I think it can be set globally for the web server config. I am not certain if you can do it per-virtual-host using Passenger, but it doesn't sound like you need that.
I know this is an old thread, but incase anyone else is having this problem just install RVM (http://rvm.beginrescueend.com/) You can literally switch versions of ruby that the system uses like this (at the command line):
Simple, no problems!
B