Skip to content

Instantly share code, notes, and snippets.

@danmartens
Last active December 27, 2015 17:58
Show Gist options
  • Save danmartens/7365748 to your computer and use it in GitHub Desktop.
Save danmartens/7365748 to your computer and use it in GitHub Desktop.
When all else fails...
# curl -L https://gist.github.com/danmartens/7365748/raw/give-up.sh | sh
# Please make sure Xcode is up to date and you've agreed to the license!
echo_purple(){
echo "\n\033[45m$1\033[0m\n"
}
clear
set -e
# Install Xcode developer tools
echo_purple "Installing Xcode developer tools..."
xcode-select --install
read -p "Press any key to continue..."
# Make sure the correct Xcode Developer folder is selected
printf "\nEnter your password to switch the Xcode Developer folder:\n"
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
# Remove rbenv
echo_purple "Removing rbenv..."
if which rbenv >/dev/null; then
brew uninstall rbenv ruby-build --force
fi
rm -rf ~/.rbenv
# Remove Homebrew
echo_purple "Removing Homebrew..."
rm -rf /usr/local/Cellar /usr/local/.git
if which brew >/dev/null; then
brew cleanup
fi
# Install Homebrew
echo_purple "Installing Homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Update brew
echo_purple "Updating Homebrew..."
brew update
# Install rbenv and ruby-build
echo_purple "Installing rbenv..."
brew install rbenv ruby-build
# Enable rbenv shims
if ! grep -q 'eval "$(rbenv init -)"' ~/.zshrc; then
echo '\neval "$(rbenv init -)"' >> ~/.zshrc
fi
# Install ruby
echo_purple "Installing ruby..."
rbenv install 2.1.2
rbenv global 2.1.2
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# Install bundler, rails, and middleman
echo_purple "Installing bundler, rails, and middleman..."
gem install bundler rails middleman --no-rdoc --no-ri
# Install libxml2 and libxslt
echo_purple "Installing libxml2 and libxslt..."
brew install libxml2 libxslt
brew link libxml2 libxslt --force
echo_purple "DONE!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment