-
-
Save yaodong/01a835417bffd60c4491 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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