▽インストール手順
1. 必要なパッケージを事前にインストールする
1 | $ sudo apt-get install build-essential bison libreadline6-dev curl git-core zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libncurses5-dev |
1 | $ sudo apt-get install rbenv ruby-build
|
3. rbenvのパスを追加
1 2 3 | $ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile $ echo 'export PATH="$HOME/.rbenv/shims:$PATH"' >> ~/.bash_profile $ source ~/.bash_profile |
▽rbenvの使い方
・インストールできるrubyバージョン一覧の表示
1 | $ rbenv install --list
|
・インストールされているバージョン一覧の表示
1 | $ rbenv versions
|
・rubyのインストール
1 2 | $ rbenv install 2.0.0-dev $ rbenv rehash |
・標準バージョンの設定
1 2 | $ rbenv shell 2.0.0-dev # 現在実行しているシェル環境上の設定 $ rbenv global 2.0.0-dev # システム全体の設定 |
・不要なバージョンを削除する
1 2 | $ rbenv uninstall -f 2.0.0-dev $ rbenv rehash |