Skip to content

Instantly share code, notes, and snippets.

@lecoueyl
Created January 5, 2017 01:17
Show Gist options
  • Save lecoueyl/0614477edb025e62df66805691ce794d to your computer and use it in GitHub Desktop.
Save lecoueyl/0614477edb025e62df66805691ce794d to your computer and use it in GitHub Desktop.
rbenv-install-system-wide.sh
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
git clone https://github.com/rbenv/ruby-build.git /usr/local/rbenv/plugins/ruby-build
# Add rbenv to the path:
echo '# rbenv setup - only add RBENV PATH variables if no single user install found' > /etc/profile.d/rbenv.sh
echo 'if [[ ! -d "${HOME}/.rbenv" ]]; then' >> /etc/profile.d/rbenv.sh
echo ' export RBENV_ROOT=/usr/local/rbenv' >> /etc/profile.d/rbenv.sh
echo ' export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/rbenv.sh
echo ' eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
echo 'fi' >> /etc/profile.d/rbenv.sh
chmod +x /etc/profile.d/rbenv.sh
source /etc/profile.d/rbenv.sh
# Install Ruby 2.2.5:
rbenv install 2.2.5
rbenv global 2.2.5
# Rehash:
rbenv rehash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment