Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jvidalba1/92a7dbc222777318a4e6 to your computer and use it in GitHub Desktop.
Save jvidalba1/92a7dbc222777318a4e6 to your computer and use it in GitHub Desktop.

How to install Ruby 1.9.3-p392 on Mac OSX 10.8+

RVM:

rvm get stable && rvm reload

Firstly, the OpenSSL comes with your OSX 10.8+ is outdated, you need to get latest version

rvm pkg install openssl

Secondly, the readline library on OSX 10.8+ suffers UTF-8 issue in which method in UTF-8 is converted to characters, the fix is to use latest version

rvm pkg install readline

Please note that clang-425.0.24 that comes with Xcode does NOT successfully compile the source, and you'll bump into this error:

Last 10 log lines:
compiling regenc.c
compiling regerror.c
compiling regexec.c
compiling regparse.c
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;
    ~~~~~~ ~~~^~~~~~~~~~~
1 error generated.
make: *** [regparse.o] Error 1

here is the fix:

export CFLAGS=-Wno-error=shorten-64-to-32
rvm reinstall 1.9.3 --with-readline-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr

rbenv

Make sure your ruby-build is up-to-date:

cd ~/.rbenv/plugins/ruby-build && git pull

rbenv does not fetch fixed readline lib or openssl, thus you are required to install them manually with brew:

brew update
brew install readline openssl
export CFLAGS=-Wno-error=shorten-64-to-32
env CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 1.9.3-p392
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment