rbenv

日経linuxの4月号より

$ sudo apt-get –y install zlib1g-dev build-essential libssl-dev libreadline-dev git   これはもちろんubuの場合、centの場合は個別にyumるしかないかな

以下もubuの場合、centの場合は、./.profileじゃ即動かないカモ

$ git clone git://github.com/sstephenson/ruby-build.git
$ cd ruby-build
$ sudo ./install.sh

$ git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
$ echo 'eval "$(rbenv init -)"' >> ~/.profile
$ exec $SHELL -l
[hirasawa@localhost ~]$ rbenv
rbenv 0.4.0-45-g060f141
Usage: rbenv <command> [<args>]

Some useful rbenv commands are:
   commands    List all available rbenv commands
   local       Set or show the local application-specific Ruby version
   global      Set or show the global Ruby version
   shell       Set or show the shell-specific Ruby version
   install     Install a Ruby version using the ruby-build plugin
   uninstall   Uninstall a specific Ruby version
   rehash      Rehash rbenv shims (run this after installing executables)
   version     Show the current Ruby version and its origin
   versions    List all Ruby versions available to rbenv
   which       Display the full path to an executable
   whence      List all Ruby versions that contain the given executable

See `rbenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/sstephenson/rbenv#readme
[hirasawa@localhost ~]$ 
  728  rbenv local
  729  rbenv global
  730  rbenv versions
  731  rbenv global 2.0.0-p195
  732  rbenv versions
  733  rbenv rehash
  734  which ruby
  735  ruby -v
  736  rbenv global system