Skip to content

rbenv guide

Joshua Moody edited this page Oct 26, 2016 · 1 revision

Homebrew recently updated the location of the readline library. This caused rubies that were compiled with native readline support to have problems in the IRB (and calabash-ios console).

If you previously installed ruby with rbenv and readline support, you should reinstall your ruby as we describe below.

Install homebrew

Follow instructions to install homebrew.

http://brew.sh/

Update homebrew

# Fetch the latest packages.
$ brew update

# Install outdated packages.
$ brew upgrade 

Install rbenv

$ brew install openssl readline rbenv ruby-build

# Configure your shell dot rc file (e.g. .bashrc, .bash_profile, or .zshrc)
$ rbenv init

Install a ruby

We recommend using the most recent released version of ruby. At the moment, this is 2.3.1.

We recommend compiling ruby with readline and OpenSSL support (provided by homebrew).

$ RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl)" \ rbenv install 2.3.1

Alternatively, use this script.

# Download and install the script somewhere in your PATH
# https://gist.github.com/jmoody/02871f14147f1297f769bfd4d96742b7
$ ./rbenv-install-with-options.sh 2.3.1

Make 2.3.1 the global ruby

$ rbenv global 2.3.1

Sync ruby version

You can enforce all team member and CI are using the correct ruby using a .ruby-version in the top level of your project.

# Commit the resulting .ruby-version to source control.
$ rbenv local 2.3.1
Clone this wiki locally