Since a few months, I switched completely to apple hardware. Reason being that I develop mobile apps including iOS apps, which require you to have a mac. It’s been a very fun transition, I learned a lot of new stuff that inspired me to do things a little different on Windows as well.
One of the things I learned is how to use ruby for building test scripts and small utilities. Why ruby? Well, it’s easy to learn. Also, it’s used in the test tools I use for testing my Xamarin based apps. When you want to run Calabash tests, you have to know a little bit about Ruby development. Now this may sound like it was a breeze to get everything working, but trust me, it wasn’t so trivial when I started using these tools.
The update story of Apple
Using ruby to run tools like Calabash on Mac OS X is a bit problematic. Apple does support Ruby out of the box on every apple machine. However, the version that you get with the box is old. The ruby community has moved on to version 2.0.0 while Apple is stuck on 1.8.2 on my machine. This means that several tools that use Ruby no longer work on Mac OS X.
I personally think that Apple should keep up with the rest of the industry. But I also know that it’s near impossible to do that with all the testing involved.
Getting the proper version of Ruby installed
If you want to run the latest-greatest ruby version on your computer, then there’s several ways in which you can get it installed and configured. I choose for an installation using RVM (Ruby Version Manager). It allows you to run multiple versions of Ruby on the same machine. Not that it is important at all, but I found it to be the easiest way to get things going.
So here’s my very short version for getting Ruby 2.0 installed as the default ruby version on your Mac machine:
curl -L https://get.rvm.io | bash -s stable --ruby rvm use 2.0.0 --default
The first line installs the ruby version manager with the most recent version of Ruby (2.0 at the time of writing this post). The second line configures the ruby version on your machine to be version 2.0.
Note: I had to restart my terminal window in between these two commands. If the second command fails, close the terminal with Cmd+Q and restart it. After that it will work correctly
That’s it, happy coding!