Skip to content

Instantly share code, notes, and snippets.

@vrinek
Created June 19, 2011 10:27
Show Gist options
  • Save vrinek/1034044 to your computer and use it in GitHub Desktop.
Save vrinek/1034044 to your computer and use it in GitHub Desktop.
New installation of RVM on a vanilla OSX Snow Leopard
#!/bin/bash
# checks for GCC (installed from Xcode)
if [ "$(which gcc)" = "" ]; then
echo "You don't have Xcode installed. Please install it from http://developer.apple.com/"
exit 0
fi
# checks for git
if [ "$(which git)" = "" ]; then
echo "You don't have git installed. Please install it from http://git-scm.com/"
exit 0
fi
# checks for curl
if [ "$(which curl)" = "" ]; then
echo "You don't have curl installed. This should have been here by default :S"
exit 0
fi
# creates a directory to contain the installer
mkdir ~/.temp_rvm_install
cd ~/.temp_rvm_install
# downloads the installer
echo "Downloading RVM..."
curl -s https://rvm.beginrescueend.com/install/rvm -o rvm-installer
chmod +x rvm-installer
# sets some sane paths and installs RVM
echo "Installing RVM..."
rvm_bin_path=~/.rvm/bin rvm_man_path=~/.rvm/share/man ./rvm-installer
# does some cleanup
cd ~
rm -rf ~/.temp_rvm_install
# appends RVM function setup to your .bash_profile
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
. "$HOME/.rvm/scripts/rvm"
# checks for RVM
if [ "$(which rvm)" = "" ]; then
echo "RVM does not seem to have been properly installed or loaded...
Please try some other way from https://rvm.beginrescueend.com/rvm/install/
Sorry :("
exit 0
fi
# install new ruby
rvm install 1.8.7
# migrates previous gems
rvm system
rvm gemset export system.gems
rvm 1.8.7
rvm gemset import system
# does some cleanup
rm system.gems
# sets RVM installed ruby-1.8.7 as default
rvm --default 1.8.7
echo "
Now you need to close this Terminal window/tab and open another one
If you do \"which ruby\" you should NOT see \"/usr/bin/ruby\"
I hope it worked, good luck :)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment