2015年2月9日月曜日

Macでrbenvを使ってRubyをインストールしてみる

rvmがなぜか消えてたので、rbenvを入れてみる。
(seppukuした形跡があった。。)

MacなんでHomebrewでインストールしちゃる。


$ brew install rbenv                                 [~]
==> Downloading https://github.com/sstephenson/rbenv/archive/v0.4.0.tar.gz
######################################################################## 100.0%
==> Caveats
To use Homebrew's directories rather than ~/.rbenv add to your profile:
export RBENV_ROOT=/usr/local/var/rbenv

To enable shims and autocompletion add to your profile:
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
==> Summary
🍺  /usr/local/Cellar/rbenv/0.4.0: 31 files, 152K, built in 3 seconds

$ brew install ruby-build                            [~]
==> Installing dependencies for ruby-build: autoconf, pkg-config, openssl
==> Installing ruby-build dependency: autoconf
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/autoconf-2.
######################################################################## 100.0%
==> Pouring autoconf-2.69.mavericks.bottle.1.tar.gz
🍺  /usr/local/Cellar/autoconf/2.69: 69 files, 2.0M
==> Installing ruby-build dependency: pkg-config
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-
######################################################################## 100.0%
==> Pouring pkg-config-0.28.mavericks.bottle.2.tar.gz
🍺  /usr/local/Cellar/pkg-config/0.28: 10 files, 604K
==> Installing ruby-build dependency: openssl
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/openssl-1.0
######################################################################## 100.0%
==> Pouring openssl-1.0.1i.mavericks.bottle.3.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.

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

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.1i: 430 files, 15M
==> Installing ruby-build
==> Downloading https://github.com/sstephenson/ruby-build/archive/v20140919.tar.
######################################################################## 100.0%
==> ./install.sh
🍺  /usr/local/Cellar/ruby-build/20140919: 128 files, 548K, built in 3 seconds
$ brew install rbenv-gemset                          [~]
==> Downloading https://github.com/jf/rbenv-gemset/archive/v0.5.8.tar.gz
######################################################################## 100.0%
🍺  /usr/local/Cellar/rbenv-gemset/0.5.8: 12 files, 56K, built in 2 seconds
$ brew install rbenv-gem-rehash                      [~]
==> Downloading https://github.com/sstephenson/rbenv-gem-rehash/archive/v1.0.0.t
######################################################################## 100.0%
==> Downloading https://github.com/sstephenson/rbenv-gem-rehash/commit/0756890cf
######################################################################## 100.0%
==> Patching
patching file README.md
Hunk #1 succeeded at 23 (offset -2 lines).
patching file etc/rbenv.d/exec/~gem-rehash.bash
patching file gems/rbenv-gem-rehash-1.0.0/lib/rubygems_plugin.rb
patching file rubygems_plugin.rb
patching file specifications/rbenv-gem-rehash-1.0.0.gemspec
==> Caveats
If the GEM_PATH environment variable is undefined, rbenv-gem-rehash must
first execute the gem env gempath command to retrieve RubyGems' default path
so that it can can append to the path rather than override it. This can take
a while--from a few hundred milliseconds on MRI to several seconds on
JRuby--so the default path for the current Ruby version is cached to the
filesystem the first time it is retrieved.
==> Summary
🍺  /usr/local/Cellar/rbenv-gem-rehash/1.0.0: 7 files, 24K, built in 3 seconds
$ 


楽ちんでした。
あとは「rbenv install 2.0.0」とかでインストールできちゃう。
楽ちん。