Как на Mac OS X 10.8.5 обновить ruby 1.8.7 до ruby 2.1.5p273

Для установки новой версии воспользуемся Homebrew:
$ brew install ruby
==> Installing dependencies for ruby: readline, libyaml, openssl
==> Installing ruby dependency: readline
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/readline-6.3.8.mountain_lion.bottle.tar.gz
######################################################################## 100,0%
==> Pouring readline-6.3.8.mountain_lion.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

Mac OS X provides similar software, and installing this software in
parallel can cause all kinds of trouble.

OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/readline/lib
    CPPFLAGS: -I/usr/local/opt/readline/include

==> Summary
🍺  /usr/local/Cellar/readline/6.3.8: 40 files, 2,1M
==> Installing ruby dependency: libyaml
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libyaml-0.1.6.mountain_lion.bottle.1.tar.gz
######################################################################## 100,0%
==> Pouring libyaml-0.1.6.mountain_lion.bottle.1.tar.gz
🍺  /usr/local/Cellar/libyaml/0.1.6: 7 files, 352K
==> Installing ruby dependency: openssl
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/openssl-1.0.1j_1.mountain_lion.bottle.tar.gz
######################################################################## 100,0%
==> Pouring openssl-1.0.1j_1.mountain_lion.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.1j_1: 431 files, 15M
==> Installing ruby
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/ruby-2.1.5.mountain_lion.bottle.tar.gz
######################################################################## 100,0%
==> Pouring ruby-2.1.5.mountain_lion.bottle.tar.gz
🍺  /usr/local/Cellar/ruby/2.1.5: 942 files, 20M

Проверка:
$ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

Ничего не изменилось. Дело в том, что по умолчанию /etc/paths выглядит так:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

Нужно повысить приоритет установкам Homebrew, для этого надо последнюю строку поставить вначале:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Проверка:
$ ruby --version
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin12.0]

UPD: Файл /etc/paths является общим для всех пользователей. Поэтому его не рекомендуется править. Лучше добавить строку export PATH=/usr/local/bin:$PATH в файл ~/.bash_profile.

--
osx - How can I switch to ruby 1.9.3 installed using Homebrew? - Stack Overflow