Last Updated: February 25, 2016
· defeated

Build Ruby w/ GCC

Over time I've installed various versions of Xcode, Kenneth Reitz's OSX GCC Installer and now Apple's Command Line Tools. Unfortunately, I got the following error trying to build the latest version of ruby 1.9 (1.9.3-p385):

regparse.c:582:15: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
return t->num_entries;

I use rbenv and you probably should too. We can specify which compiler is used to build ruby by setting the CC environment variable to the path of gcc -

CC=gcc rbenv install 1.9.3-p385

With any luck, you should see

Installing ruby-1.9.3-p385...
Installed ruby-1.9.3-p385