Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PREFIX="/usr/local"
RBENV_PREFIX="$PREFIX/rbenv"
BIN_PATH="$PREFIX/bin"
RBENV_GROUP="rbenv"
umask 002
## Install rbenv, ruby-build and rbenv-gem-rehash
git clone git://github.com/sstephenson/rbenv.git $RBENV_PREFIX
mkdir $RBENV_PREFIX/plugins
git clone git://github.com/sstephenson/ruby-build.git $RBENV_PREFIX/plugins/ruby-build
git clone git://github.com/sstephenson/rbenv-gem-rehash.git $RBENV_PREFIX/plugins/rbenv-gem-rehash
## add rbenv script to PATH
ln -s $RBENV_PREFIX/bin/rbenv $BIN_PATH/rbenv
## Add rbenv to the System wide profile:
## @note profiles only will be sourced in `login shell`,
## see the difference here(Chinese): https://gist.github.com/yegle/1564928
cat <<EOF > /etc/profile.d/rbenv.sh
# rbenv setup
export RBENV_ROOT=${RBENV_PREFIX}
eval "\$(rbenv init -)"
EOF
chmod +x /etc/profile.d/rbenv.sh
source /etc/profile.d/rbenv.sh
## set rbenv group property
groupadd $RBENV_GROUP
chown -R :rbenv $RBENV_PREFIX
find $RBENV_PREFIX -type d -exec chmod g+Xs {} \;
## Install Ruby
#rbenv install 1.9.3-p484
#rbenv install 2.0.0-p353
#rbenv global 2.0.0-p353
## Rehash:
#rbenv rehash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.