Skip to content

Instantly share code, notes, and snippets.

@ryanwarsaw
Created May 13, 2016 17:35
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/ef1e5235bc654b98028f37604bedba02 to your computer and use it in GitHub Desktop.
Save ryanwarsaw/ef1e5235bc654b98028f37604bedba02 to your computer and use it in GitHub Desktop.
# Install Command Line Tools
if ! type xcode-select >&- && xpath=$(xcode-select --print-path) && test -d "$xpath" && test -x "$xpath"; then
# Accept the Xcode license agreement
xcodebuild -license
# Run command line tool installation script
xcode-select --install
fi
# Install Homebrew (or update if installed)
if ! brew_location="$(type -p brew)" || [ -z "$brew_location" ]; then
# Run brew installation script
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Prepare installation for use
brew doctor
else
# Update brew to the latest version
brew update
# Run system health check and fix missing links
brew doctor
# Upgrade all installed brew packages to latest versions
brew upgrade
# Remove older versions of brew packages
brew cleanup
fi
# Install RVM (Ruby Version Manager) and Ruby
if ! rvm_location="$(type -p rvm)" || [ -z "$rvm_location" ]; then
# Run RVM installation script
curl -L https://get.rvm.io | bash -s stable --ruby
# Load RVM into active shell session
source ~/.rvm/scripts/rvm
# Install latest version of Ruby
rvm use ruby --install --default
else
# Update RVM to the latest version
rvm get stable
# Install latest version of Ruby
rvm use ruby --install --default
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment