Skip to content

Instantly share code, notes, and snippets.

@brymck
Created March 13, 2012 04:32
Show Gist options
  • Save brymck/2026768 to your computer and use it in GitHub Desktop.
Save brymck/2026768 to your computer and use it in GitHub Desktop.
Getting Xcode to compile the latest Ruby
#!/bin/sh
#
# First install the latest Command Line Tools for Xcode package:
# https://developer.apple.com/downloads/index.action?name=command%20line%20tools%20for%20xcode
#
# You can then run this by either copying and pasting everything into a terminal or running:
# bash -s < <(curl -L https://raw.github.com/gist/2026768/konjac_env.sh)
#
# Install Homebrew
if [ ! "$(brew -v)" ]
then
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
fi
# Get Homebrew dependencies
brew install autoconf automake libxml2 libxslt
brew link libxml2 libxslt
# Get the latest versions of RVM
if [ -s "$HOME/.rvm/scripts/rvm" ]
then
source "$HOME/.rvm/scripts/rvm"
rvm get head
else
bash -s head < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
source ~/.bash_profile
fi
source "$HOME/.rvm/scripts/rvm"
# Install the latest version of Ruby
LATEST_RUBY="$(rvm list known | grep -oP "(?<=\[ruby-\])[0-9.]+-head" | tail -1)"
rvm install $LATEST_RUBY
rvm use $LATEST_RUBY --default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment