Skip to content

Instantly share code, notes, and snippets.

@runlevel5
Last active December 14, 2015 04:08
Show Gist options
  • Save runlevel5/5025635 to your computer and use it in GitHub Desktop.
Save runlevel5/5025635 to your computer and use it in GitHub Desktop.
Installing Ruby 2.0.0-p247 on OSX 10.7+

How to install Ruby 2.0.0-p247 on Mac OSX 10.7+

RVM:

rvm get stable && rvm reload

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

rvm pkg install openssl

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

rvm pkg install readline

And you can install Ruby 2.0.0-p247 with:

rvm reinstall 2.0.0 --with-readline-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr

Please note that clang-425.0.24 that comes with Xcode successfully compile the source, should you bump into any compilation issue, you could try compiling it with gcc-422

rbenv

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

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

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

brew update
brew install readline openssl
CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p247

chruby + ruby-build

If you happen to use something simpler than rbenv and rvm, such as chruby, you can still use ruby-build to compile ruby into your local ~/.rubies folder with:

brew update
brew install readline openssl
CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" ruby-build 2.0.0-p247 ~/.rubies/ruby-2.0.0-p247

then insert into the top of your ~/.bash_profile to use it by default:

chruby ruby-2.0.0-p247
@CaDs
Copy link

CaDs commented Feb 25, 2013

not 100% sure but for my installation on mac rvm reinstall 2.0.0 --with-readline-dir=$rvm_path/usr -with-openssl-dir=$rvm_path/usr was missing a - before with-openssl-dir

rvm reinstall 2.0.0 --with-readline-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr did the trick

Thanks!

@kaievns
Copy link

kaievns commented Feb 25, 2013

brew already has the latest ruby-build with 2.0.0-p0 in it.

rbenv install 2.0.0-p0 also worked flawlessly for me without any monkeying with openssl/readline

@thenickcox
Copy link

I was having issues with this, but this helped. Thanks!

@runlevel5
Copy link
Author

@CaDs thanks for pointing out the typo

@runlevel5
Copy link
Author

@madrabbit: thanks for that. Though I prefer to have it compile against my brew lib

@davidcelis
Copy link

rbenv, for 2.0.0-p0, does fetch and install a version of OpenSSL 1.0.1e (with certificates). So, really, only a brewed readline is necessary. And I'm not even sure if that's necessary anymore.

@runlevel5
Copy link
Author

@davidcells: thanks for that info, I have amended the gist

@samsonjs
Copy link

samsonjs commented Sep 4, 2013

I have to use RUBY_CONFIGURE_OPTS now, but otherwise this seems to still work.

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