ruby-buildのupgrade(brew編)

★ブログ移行のお知らせ
サイトを移行しました。以下をクリックください。
きよしの倶楽部 – 生活を潤わす情報を発信中。GTDを得意としてます。


ーーー
前回の記事にも書きましたが、モバイル用のMac Book Airの方は新規にbrewからrbenvをインストールした感じですが、もう一つの愛機、Mac Miniの方は放置のままでした。

MBAの方のrubyを2.0系にしたので、デスクトップも同じくアップグレード、と行きたいとこですが、うまくいきませんでした。

kytmacmini:~ kyt$ rbenv versions
  system
  1.9.3-p0
* 1.9.3-p392 (set by /Users/kyt/.rbenv/version)
  2.0.0-p0

あらー。結構、バージョンインストールされてるな。ということで必要な物意外は削除しました。
一応1.9系は、万が一、過去のお客さんからの突っ込みがあった際に検証しないと行けないのでp392は残します。

kytmacmini:~ kyt$ sudo rbenv uninstall -f 1.9.3-p0
kytmacmini:~ kyt$ sudo rbenv uninstall -f 2.0.0-p0

sudoでインストールしたモジュールがあったようで、パーミッションの関係でsudo実行です。
MBAとあわせる2.0.0-p353を突っ込もうとした所、

kytmacmini:~ kyt$ rbenv install 2.0.0-p353
ruby-build: definition not found: 2.0.0-p353

You can list all available versions with `rbenv install --list'.

If the version you're looking for is not present, first try upgrading
ruby-build. If it's still missing, open a request on the ruby-build
issue tracker: https://github.com/sstephenson/ruby-build/issues

ん? rbenv install -l してみると確かにないです。2系のp353。

ruby-buildのバージョン確認。

kytmacmini:~ kyt$ ruby-build --version
ruby-build 20130408

ありゃ、古いわ。で、upgradeということで、

kytmacmini:~ kyt$ brew upgrade ruby-build
Error: ruby-build-HEAD already installed

えーと、どうしましょ。どうしようもないので、削除、再インストールです。

kytmacmini:~ kyt$ brew uninstall ruby-build
kytmacmini:~ kyt$ brew install ruby-build
==> Installing ruby-build dependency: openssl
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/openssl-1.0
######################################################################## 100.0%
==> Pouring openssl-1.0.1f.mavericks.bottle.tar.gz
==> Caveats
This formula is keg-only, so 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.

The OpenSSL provided by OS X is too old for some software.

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
==> security find-certificate -a -p /Library/Keychains/System.keychain > '/usr/l
==> security find-certificate -a -p /System/Library/Keychains/SystemRootCertific
==> mv -f /usr/local/etc/openssl/osx_cert.pem.tmp /usr/local/etc/openssl/osx_cer
==> Summary
🍺  /usr/local/Cellar/openssl/1.0.1f: 429 files, 15M
==> Installing ruby-build
==> Downloading https://github.com/sstephenson/ruby-build/archive/v20140110.1.ta
######################################################################## 100.0%
==> ./install.sh
🍺  /usr/local/Cellar/ruby-build/20140110.1: 105 files, 460K, built in 3 seconds

opensslですか。確かにMBAは別件があって、ちゃんとupgrade済みでした。
折角なので

kytmacmini:~ kyt$ openssl version
OpenSSL 1.0.1f 6 Jan 2014

たしかに。必要に応じてbrew link openssl --forceですかね。

kytmacmini:~ kyt$ ruby-build --version
ruby-build 20140110.1
kytmacmini:~ kyt$ rbenv install -l
Available versions:
  2.0.0-p353

確かにでてきた。

あとはこちらを参考に、globalに反映させればOKです。