Skip to content

Instantly share code, notes, and snippets.

@sferik
Created November 5, 2012 02:28
Show Gist options
  • Save sferik/4014963 to your computer and use it in GitHub Desktop.
Save sferik/4014963 to your computer and use it in GitHub Desktop.
Instructions to install on Ruby 2.0.0 on Mac OS X with homebrew
#!/usr/bin/env sh
brew update
brew install rbenv
brew install ruby-build
brew install openssl
CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` rbenv install 2.0.0-preview1
@nicolasblanco
Copy link

Great 👍 !

On OS X Mountain Lion, I had to add also --with-gcc=clang to CONFIGURE_OPTS to avoid a compilation error.

@byennen
Copy link

byennen commented Nov 9, 2012

Thanks!

@bettysteger
Copy link

hmmm i got the following error, when doing your rbenv command..

BUILD FAILED

Inspect or clean up the working tree at /var/folders/63/6371tP-tEXaPCC4JHxbmNU+++TI/-Tmp-/ruby-build.20130405124859.9988
Results logged to /var/folders/63/6371tP-tEXaPCC4JHxbmNU+++TI/-Tmp-/ruby-build.20130405124859.9988.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/63/6371tP-tEXaPCC4JHxbmNU+++TI/-Tmp-/ruby-build.20130405124859.9988/openssl-1.0.1e /var/folders/63/6371tP-tEXaPCC4JHxbmNU+++TI/-Tmp-/ruby-build.20130405124859.9988 ~
Operating system: i686-apple-darwinDarwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386
Configuring for darwin64-x86_64-cc
Usage: Configure [no- ...] [enable- ...] [experimental- ...] [-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]

@bigardone
Copy link

Yes, I got the same error :(

@dvliman
Copy link

dvliman commented Apr 8, 2013

@lpsBetty @bigardone Ran into same issue just now. You need to install xcode and run it for the first time. Additionally, you want to install xcode command line tools to for "make". Go to apple dev website. You can download it for free.

@bettysteger
Copy link

i already have xcode command line tools installed.. (but not the full xcode)

@bettysteger
Copy link

got the same error when trying to install p195 :(

please tell me if this worked for you:
https://gist.github.com/lpsBetty/5584686

@cbandy
Copy link

cbandy commented May 15, 2013

Should be RUBY_CONFIGURE_OPTS

@timcharper
Copy link

I still had issues. I had to add a few lines to the top of ext/openssl/openssl_missing.h in addition to specifying homebrew installed openssl. Details of what worked for me here: https://gist.github.com/timcharper/5778185

@translunar
Copy link

Here's the command I used for installing for development purposes --

CC=gcc-4.7 RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline` --with-gcc=gcc-4.7 --enable-shared" rbenv install --keep 2.0.0-p195

The -k is for --keep, which I seem to need since I'm developing Ruby C extensions.

I also found it necessary to use CC=gcc-4.7 because otherwise it would ALWAYS insist upon appending this Wshorten-64-to-32 flag, no matter which compiler I was using to build extensions. --with-gcc=gcc-4.7 is insufficient.

Note: This also seems to work with later GCC versions. I've tested with 4.8 and 4.9 also, but it's been a while.

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