There is no Ruby, by default, on a new install of Ubuntu
$ ruby -v The program 'ruby' can be found in the following packages: * ruby1.8 * ruby1.9.1 Try: sudo apt-get install
What? I don't want to use either of those, I want Ruby 1.9.2! That's okay, I would rather skip the system Ruby and use RVM anyway. And there's even a package for it now!
$ sudo apt-get install ruby-rvm [sudo] password for tim: Reading package lists... Done ... $ which rvm /usr/bin/rvm
Easy peasy! Now, install the Ruby I want
$ rvm install 1.9.2 ... Install of ruby-1.9.2-p180 - #complete $ rvm list rvm rubies ruby-1.9.2-p180 [ x86_64 ]
Now update my shell (I also add this to my .bashrc file)
$ . /usr/share/ruby-rvm/scripts/rvm
And I'm all set!
$ rvm use 1.9.2 Using /usr/share/ruby-rvm/gems/ruby-1.9.2-p180 $ ruby -v ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] $ ruby -e 'puts "Hello, world!"' Hello, world!
Let's try installing a gem
$ gem install opt-simple Fetching: opt-simple-0.9.9.gem (100%) Successfully installed opt-simple-0.9.9 1 gem installed Installing ri documentation for opt-simple-0.9.9... Installing RDoc documentation for opt-simple-0.9.9... $ ri OptSimple ...
Nice!
I use perlbrew and pythonbrew to do something similar for Perl and Python. They are all easy to use, but rvm seemed too complicated to set up. Well, not any more! The above steps are no worse than the ones for perlbrew and pythonbrew.
Recent Comments