Last Updated: February 25, 2016
·
2.872K
· aalvarado

Install Ruby 2.0 on OSX with rbenv and macport's readline support ( reverse search on pry works!)

OSX ships with the older libedit library which is what rbenv picks up if not given an explicit --with-readline-dir configuration flag. I was able to find a lot of info of installing with homebrew but none with macports ( except this one: http://d.hatena.ne.jp/CortYuming/20120606/p1 ) which is in japanese :(. Luckily the bash prompt is in english.

Also I didn't want to use libedit and do this: http://hints.macworld.com/article.php?story=20080313113705760 #sadness :(

In short you want to add it like this ( you might want to throw in openssl support from the same place too ) :

$ CONFIGURE_OPTS="--with-openssl-dir=/opt/local --with-readline-dir=/opt/local" rbenv install 2.0.0-p0

Now I can do:

$ pry
[1] pry(main)> foo = 1
=> 1
(reverse-i-search)`foo': foo = 1

Niceness.

Have fun!

4 Responses
Add your response

Thanks dude! That did the trick.

over 1 year ago ·

Works great! Also works for 2.0.0-p195.

over 1 year ago ·

Great, thank you. I have been using macports for a lot of bins, libs like opnessl etc., but recently installed rbenv, so compilation of ruby failed, but with these flags it works perfectly.

over 1 year ago ·

me gusta

over 1 year ago ·