How to install Ruby 2.0 (ruby-head) with RVM
I got a bit excited when I read about the Ruby 2.0.0 ‘Feature Freeze’ and wanted to give ruby 2.0 a test.
This is what I did to get it installed on Mac OS X 10.8.2 with RVM (and Homebrew).
$ brew install autoconf
$ brew install automake
$ brew install libyaml
$ rvm install ruby-head
To use it you just have to tell RVM to use it:
$ rvm use ruby-head
$ ruby --version
ruby 2.0.0dev (2012-10-12 trunk 37163) [x86_64-darwin12.2.0]
When it is installed you can for example test out named arguments:
# named_arguments.rb
def hello(name: 'world')
puts "hello #{name}"
end
hello name: 'boss'
$ ruby named_arguments.rb
hello boss