Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Ruby 1.8.7 on macOS Sierra (10.12) with rbenv
brew install apple-gcc42 openssl libyaml libffi
xcode-select --install
export CC=/usr/local/bin/gcc-4.2
export CFLAGS='-g -O2'
export RUBY_CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl`
export CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl`
# I had to edit the svn repo URL in /usr/local/Cellar/ruby-build/20160913/share/ruby-build/1.8.7-p375 and change the URL from http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7 to https://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7
rbenv install 1.8.7-p375
@fanaugen
Copy link

fanaugen commented Aug 29, 2017

For me brew install apple-gcc42 fails with

apple-gcc42: This formula either does not compile or function as expected on macOS
versions newer than Mavericks due to an upstream incompatibility.

So I installed ruby 1.8.7-p375 with Apple LLVM version 8.1.0 (clang-802.0.42) instead, but now am getting nasty segfaults whenever gem install attempts to compile native extensions. Any pointers on how to install actual GCC 4.2 on Sierra?

[Update]: I was able to compile both Ruby 1.8.7-p375 and Ruby Enterprise Edition 1.8.7-2012.02 with GCC 4.8 (installed via brew)

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