Confusion over installed versions


I have got confused by ruby/gems etc as i seem to have some kind of path issues somehow. First issue is i seem to have 3 flavours of ruby installed …

ruby -v

ruby 1.9.3p374 (2013-01-15) [i686-linux]

/opt/ruby-enterprise-1.8.7-2012.01/bin/ruby -v

ruby 1.8.7 (2011-12-28 MBARI 8/0x8770 on patchlevel 357) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2012.01

/opt/ruby/bin/ruby -v

ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-linux]

grep ruby /etc/httpd/conf/httpd.conf

LoadModule passenger_module /opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/

PassengerRoot /opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.11

PassengerRuby /opt/ruby/bin/ruby

So i guess i am using /opt/ruby/bin/ruby for live web site?

So then when i try to do anything with the gem command it is not happy…

gem -v

/usr/bin/ruby: No such file or directory – ‘–prefix=/usr’ (LoadError)

/opt/ruby-enterprise-1.8.7-2012.01/bin/gem -v


/opt/ruby/bin/gem -v

/usr/bin/ruby: No such file or directory – ‘–prefix=/usr’ (LoadError)

Im assuming that i need to be using “gem -v” which in turn is the same as “/opt/ruby/bin/gem -v”? But neither works.

Any idea how to set a path or some such so i can use the gem commands? I have Googled a bit but havent found a good (understandable!) answer. Also how do i uninstall the unused ruby versions?

Thanks in advance.


Use rvm (or rbenv, but I have not personal experience of that) to manage ruby and gems.