LoginSignup
105
103

More than 5 years have passed since last update.

rbenvを使ってシステムワイドにrubyをインストールする方法

Posted at

各ユーザごとではなく/usr/local/以下にrbenvをインストールしてシステムワイドに使えるようにする手順。各ユーザがstaffグループに参加していると仮定している。

rbenvインストール

cd /usr/local
git clone git://github.com/sstephenson/rbenv.git rbenv
chgrp -R staff rbenv
chmod -R g+rwxXs rbenv

/etc/profileとか~/.profileとかで環境変数を設定しておく。設定した後はsourceコマンドで適応しておくと良い。

環境変数設定

export RBENV_ROOT=/usr/local/rbenv
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"

rubyをインストールするためにruby-buildをインストール

ruby-buildインストール

mkdir /usr/local/rbenv/plugins
cd /usr/local/rbenv/plugins
git clone git://github.com/sstephenson/ruby-build.git
chgrp -R staff ruby-build
chmod -R g+rwxs ruby-build

rbenv経由でrubyをインストール

rbenv install 1.9.3-p194
rbenv rehash
rbenv global 1.9.3-p194
105
103
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
105
103