My computer has two flavors of Ruby: good old 1.8.6 that ships with OS X, and 1.9.1 that I installed with MacPorts.
Until yesterday, I was chicken on 1.9.1, not pig. Most times I would remember to run 1.9 commands. Other times, I would be running 1.8 (e.g. Rails’s script/console insist on using the ruby command, which fires up 1.8.6).
I hedged writing code that works on both flavors. Until yesterday.
Step 1: Went and uninstalled all the gems in the 1.8 repository. Can’t do much with an empty repository, if I end up running 1.8 by mistake, it will fail early.
Step 2: Symlinked /usr/bin/ruby, irb, rdoc and other Ruby commands to their 1.9 counterparts located in /opt/local/bin. Now everything that tries to run Ruby runs 1.9.1.
Step 3: Going to start writing some code to take advantage of new language features and idioms.
Based on an informal poll of two people at tonight’s SF Ruby Meetup event, I’m not alone. It’s still not smooth sailing and you have to give up on the occasional gem or fork a fix (Github makes that easy). In the long run, it’s worth the effort.
When did you make the switch?