Skip to content

Instantly share code, notes, and snippets.

@runlevel5
Last active January 23, 2019 22:51
Show Gist options
  • Save runlevel5/5025729 to your computer and use it in GitHub Desktop.
Save runlevel5/5025729 to your computer and use it in GitHub Desktop.
How to install Ruby 1.9.3-p392 on OSX 10.8+

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
@kevinSuttle
Copy link

Weirdness.

☰  env CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p0
Downloading openssl-1.0.1e.tar.gz...
-> https://www.openssl.org/source/openssl-1.0.1e.tar.gz
Installing openssl-1.0.1e...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/gl/zrvk3vz908g96m9fds51ytz40000gn/T/ruby-build.20130224223214.18249
Results logged to /var/folders/gl/zrvk3vz908g96m9fds51ytz40000gn/T/ruby-build.20130224223214.18249.log

Last 10 log lines:
x openssl-1.0.1e/VMS/TODO
x openssl-1.0.1e/VMS/ucx_shr_decc_log.opt
x openssl-1.0.1e/VMS/ucx_shr_decc.opt
x openssl-1.0.1e/VMS/ucx_shr_vaxc.opt
x openssl-1.0.1e/VMS/VMSify-conf.pl
x openssl-1.0.1e/VMS/WISHLIST.TXT
/var/folders/gl/zrvk3vz908g96m9fds51ytz40000gn/T/ruby-build.20130224223214.18249/openssl-1.0.1e /var/folders/gl/zrvk3vz908g96m9fds51ytz40000gn/T/ruby-build.20130224223214.18249 ~/.rbenv/plugins/ruby-build
Operating system: i686-apple-darwinDarwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64
Configuring for darwin64-x86_64-cc
Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]

Maybe I don't understand Homebrew, but I never installed Ruby or Ruby-Build via brew, so I'm confused on how it's being updated. Wonder if this is what is causing my issues.

☰  brew update 
Updated Homebrew from a7f01dfd to 3e7cc037.
==> New Formulae
bats        makedepend  ncdc        tlsdate
==> Updated Formulae
arangodb       go         irrlicht       media-info     octave     sbcl       youtube-dl
cvsps          gosu       jruby      metasploit     postgres-xc    scm-manager
dcraw          grc        juise      mksh       reposurgeon    spatialindex
ffmpeg         gtk+       leveldb        mpd        riak       squashfs
fontforge      hadoop         libassuan      node       ruby       svtplay-dl
freetype       hydra          maven      ntfs-3g        ruby-build     wireshark

Weird output.

☰  brew install readline openssl
==> Downloading http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.03.tar.gz
######################################################################## 100.0%
==> ./installer --auto /usr/local/Cellar/ruby-enterprise-edition/2011.03 --no-tcmalloc -c --with-readline-dir
./lib/fileutils.rb:1416: [BUG] unexpected local variable
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin12.2.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03

make: *** [.rbconfig.time] Abort trap: 6

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting

☰  

@runlevel5
Copy link
Author

@kevinSuttle: this is not for 2.0.0-p0, please see my other gist https://gist.github.com/joneslee85/5025635

@gmcnaughton
Copy link

The rvm reinstall command line is missing a dash: -with-openssl-dir should be --with-openssl-dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment