I have Ruby versions 1.8.7 and 1.9.1 on Ubuntu.
How do I get the system to register Ruby 1.9.1 when using ruby -v
?
ruby is at /usr/bin/ruby
ruby1.9.1 is at /usr/bin/ruby1.9.1
Also, can someone recommend a free text editor for Ubuntu?
I have Ruby versions 1.8.7 and 1.9.1 on Ubuntu.
How do I get the system to register Ruby 1.9.1 when using ruby -v
?
ruby is at /usr/bin/ruby
ruby1.9.1 is at /usr/bin/ruby1.9.1
Also, can someone recommend a free text editor for Ubuntu?
find ruby in your path. Either change your PATH variable to direct through the Ruby 1.9 executable (assuming different directories) or create a symbolic link of "ruby" to the versiuon you want.
The alias solution above will work, but only when your envuironment 8is sourced into the shell. The link method works anywhere in a UNIX-like system.
Lert's assume you have the executables in /usr/bin
. This means that there is something like
/usr/bin/ruby
/usr/bin/ruby1.9
What you need is to
ln -s /usr/bin/ruby1.8.7 /usr/bin/ruby
ln -s /usr/bin/ruby1,9 /usr/bin/ruby
Ideally, you might want to have a default that sets one version or the other.
This script would, by necessity, have to be run through sudo
. If you don't want to, or cant, then set up your own bin
directory at, say, ~/bin
and have a script that links ruby to /usr/bin/ruby
or /usr/bin/ruby1.9
as desired. Make sure your bin is before the more global bins in your path and you'll be set.
I would consider using rvm to manage multiple versions of Ruby. At first I was a bit skeptical about it, but once installed and configured, I found it works perfectly. I can now flip between 1.8.7, 1.9.2, and JRuby-1.5.1 and the paths change automatically.
I am assuming by text editor, he means a text editor for Ruby. There are a ton of options: Kate, Komodo, Vim, Emacs, etc. However for Ruby development, I would recommend Redcar. Its cross platform compatible, open source, supports textmate bundles, and is written entirely in Ruby so its easy to extend with plugins.
An ubuntu-like way could also be using "update-alternatives" as described here
Using RVM might save you a headache or two though :)
As for the texteditor: just use gedit and enable a few of its plugins
Hi Roger,
You can do that by using a symbolic link
ln -s /usr/bin/ruby1.9.1 /usr/bin/ruby
cheers
sameera
I found out how to do it on it a Mac, probably the same for ubuntu:
http://stackoverflow.com/questions/3243088/installing-rvm-ruby-version-manager