Setting-up Ruby development environment on MacOS 10.8.5

MacOS X 10.8.5 (and a few versions earlier) is coming with a pre-installed Ruby 1.8.x. That might not be enough though for what a developer needs.
Just as any respectable programming language, Ruby is continuously developed and upgraded. Us, as developers, of course will always want to update the version of Ruby installed on our development machine.
But MacOS doesn’t make it that easy. As a matter of fact, any server-side programming language you might want to develop on a MacOS machine, you get into the same problem: Upgrading requires you to manually reinstall it or recompile it.

If you’re a geek like me, you don’t want to use package managers to install/update things on your MacBook and you find it rather challenging and cool to compile yourself the software, then you may read this further.

Things you need to download:
1. Ruby: https://www.ruby-lang.org/en/downloads/
(I wanted to upgrade to Ruby 1.9.3 so I used this link: http://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p448.tar.gz )
2. LibYAML: http://pyyaml.org/wiki/LibYAML
(latest stable version available at the time I’m writing this: http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz )

Other pre-requisites:
X-Code: https://developer.apple.com/xcode/
Why do you need X-Code? MacOS by default does not have the C compiler installed. By installing X-Code you will also get everything you need to be able to compile from C sources yourself.

Installation steps:
1. You need to compile and install LibYAML before you compile Ruby.
This will run pretty easy and fast, instructions are also to be found on LibYAML website

./configure --prefix=/usr
make
sudo make install

2. After successfully installing LibYAML, we can now proceed to install the new version of Ruby
The procedure is the same as for LibYAML

./configure --prefix=/usr
make
sudo make install

But after that, we will also want to update the gem module and eventually install some other gems we need for development

sudo gem update --system

On Viget’s blog I also found a cool article on configuring autotest to run through Growl, thus using MacOS native file scans and reducing processor usage and battery consumption: http://viget.com/extend/how-why-to-run-autotest-on-your-mac

Leave a Reply

Your email address will not be published. Required fields are marked *

Blue Captcha Image
Refresh

*