Skip to content

Instantly share code, notes, and snippets.

@ryanwarsaw
Last active May 13, 2016 04:33
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 ryanwarsaw/fa35f9aa73276e9d07c2281e5d3b5030 to your computer and use it in GitHub Desktop.
Save ryanwarsaw/fa35f9aa73276e9d07c2281e5d3b5030 to your computer and use it in GitHub Desktop.
# Install Command Line Tools (Xcode) if it isn't already installed.
if type xcode-select >&- && xpath=$(xcode-select --print-path) && test -d "$xpath" && test -x "$xpath" ; then
# TODO: Reverse if statement logic to remove unnecessary logic.
else
xcode-select --install
fi
# Install Homebrew (Package Manager) if it isn't already installed.
if ! brew_location="$(type -p brew)" || [ -z "$brew_location" ]; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Prepare installation for use
brew doctor
fi
# Install the RVM (Ruby Version Manager) if it doesn't exist
# If it does, update it and install the latest version of Ruby
if ! rvm_location="$(type -p rvm)" || [ -z "$rvm_location" ]; then
# Download RVM and install it
curl -L https://get.rvm.io | bash -s stable --ruby
# Load RVM into shell
source ~/.rvm/scripts/rvm
# Install latest version of Ruby (and set it as default version)
rvm use ruby --install --default
else
# Upgrade RVM to the latest stable version
rvm get stable
# Install latest version of Ruby (and set it as default version)
rvm use ruby --install --default
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment