Skip to content

Instantly share code, notes, and snippets.

@xguse
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xguse/f35e60ae4b1c059d8dc5 to your computer and use it in GitHub Desktop.
Save xguse/f35e60ae4b1c059d8dc5 to your computer and use it in GitHub Desktop.
Install the ruby RVM on a mac
#!/bin/bash
echo ''
echo ''
echo ''
echo "This script automates the instructions found on this webpage: http://code.tutsplus.com/tutorials/how-to-install-ruby-on-a-mac--net-21664"
echo ''
echo ''
echo ''
#### Download and install RVM stuff
curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled # Or, --ruby=2.1.3
#### Configure your shell to use the RVM
bashrc_rvm='[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session. It MUST be the LAST PART of this file!!'
# Append to your shell initiation file
bash_profile=${HOME}/.bash_profile
bash_login=${HOME}/.bash_login
profile=${HOME}/.profile
zshrc=${HOME}/.zshrc
shell_init=''
if [ -f "$bash_profile" ]
then
echo $bashrc_rvm >> $bash_profile
shell_init=$bash_profile
elif [ -f "$bash_login" ]
then
echo $bashrc_rvm >> $bash_login
shell_init=$bash_login
elif [ -f "$profile" ]
then
echo $bashrc_rvm >> $profile
shell_init=$profile
elif [ $zshrc ]
then
echo $bashrc_rvm >> $zshrc
shell_init=$zshrc
else
echo "No shell init file found!!"
exit
fi
#### reinitialize the shell to use the RVM
source $shell_init
#### Install ruby 2.1.3 and switch to that version
rvm install 2.1.3
rvm use 2.1.3
# make this version default
rvm --default use 2.1.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment