Skip to content

Instantly share code, notes, and snippets.

@yamishi13
Last active June 21, 2017 16:30
Show Gist options
  • Save yamishi13/e9114970e1967e8bea8c to your computer and use it in GitHub Desktop.
Save yamishi13/e9114970e1967e8bea8c to your computer and use it in GitHub Desktop.
Rbenv_installer.sh
#!/bin/bash
# Rbenv Installer for ubuntu
rubyb=2.1.2
# Verify it is not being run as root
if [ $EUID -eq 0 ] ; then
echo "Don't run this script as root if you don't want to have nightmares at night" >> /dev/stderr
exit 1
fi
while [ $# -gt 0 ] ; do
case $1 in
-i | --install | -r | --ruby ) echo "$2 choosed as default ruby binary" ; rubyb=$2 ; shift ;;
esac
done
sudo apt-get install git autoconf bison build-essential libssl-dev libyaml-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev -y
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv rehash
rbenv install $rubyb
rbenv global $rubyb
rbenv rehash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment