Skip to content

Instantly share code, notes, and snippets.

@jescalan
Created April 6, 2012 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jescalan/2322862 to your computer and use it in GitHub Desktop.
Save jescalan/2322862 to your computer and use it in GitHub Desktop.
Environment Setup
#!/bin/sh
# --------------------------------------------------------------------------------------
# Sets up your computer with the tools you need to develop in a modern ruby environment.
# --------------------------------------------------------------------------------------
# This install includes:
# - homebrew
# - rbenv
# - ruby-build
# - ruby 1.9.3-p125
# - git
# - rubygems
# - bundler
# - pow
# - powder
# - haml
# - sass
# - coffeescript
# - stasis
# - rails
set -e
# idea from pow - fail if osx is less than 10.6
if [ "$(uname -s)" != "Darwin" ]; then
echo "Sorry, this script requires Mac OS X" >&2
exit 1
elif [ "$(expr "$(sw_vers -productVersion | cut -f 2 -d .)" \>= 6)" = 0 ]; then
echo "This script requires Mac OS X 10.6 or later." >&2
exit 1
fi
echo ""
echo "Do you have GCC already installed? (answer 1 or 2) - if you aren't sure, type 2"
select yn in "Yes" "No"; do
case $yn in
Yes ) echo ""
echo "-----------------------------";
echo "Setting up command line prefs";
echo "-----------------------------";
mv ~/.bash_profile ~/.profile;
echo "PS1='\[\e[0;31m\]⚡\[\e[m\] \[\e[0;30m\]${PWD##*/}\[\e[39m\] '" >> ~/.profile;
source ~/.profile;
echo "-------------------";
echo "Installing Homebrew";
echo "-------------------";
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)";
brew update;
echo "----------------";
echo "Installing rbenv";
echo "----------------";
brew install rbenv;
echo 'export PATH="$HOME/.rbenv/bin:/usr/local/bin:$PATH"' >> ~/.profile;
echo 'eval "$(rbenv init -)"' >> ~/.profile;
source ~/.profile;
echo "---------------------";
echo "Installing ruby-build";
echo "---------------------";
brew install ruby-build;
echo "---------------------";
echo "Installing ruby 1.9.3";
echo "---------------------";
rbenv install 1.9.3-p125;
rbenv rehash;
rbenv global 1.9.3-p125;
echo "--------------";
echo "Installing git";
echo "--------------";
brew install git;
echo "-----------------";
echo "Updating rubygems";
echo "-----------------";
sudo ruby setup.rb;
gem update --system;
touch ~/.gemrc;
~/.gemrc >> echo "gem: --no-ri --no-rdoc";
echo "------------------";
echo "Installing bundler";
echo "------------------";
sudo gem install bundler;
echo "--------------";
echo "Installing pow";
echo "--------------";
curl get.pow.cx | sh;
echo "-----------------";
echo "Installing powder";
echo "-----------------";
sudo gem install powder;
echo "-------------------------------------";
echo "Installing haml, sass, & coffeescript";
echo "-------------------------------------";
sudo gem install haml;
sudo gem install sass;
sudo gem install coffee-script;
echo "-----------------";
echo "Installing stasis";
echo "-----------------";
sudo gem install stasis;
echo "----------------";
echo "Installing rails";
echo "----------------";
sudo gem install rails;
echo ""
echo "Boom! All finished. Everything should be good to go."
echo ""
break;;
No ) echo "Ok, I'll download and install it for you now.";
cd ~/Desktop; curl -O http://up.jenius.me/command-line-tools.dmg;
hdiutil mount command-line-tools.dmg;
sudo cp -r /Volumes/Command\ Line\ Tools/ ~/Desktop;
open Command\ Line\ Tools.mpkg;
rm ~/Desktop/Command\ Line\ Tools/
echo "";
echo "Ok, you're all set. Install and run this script again afterwards.";
echo "";
break;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment