Skip to content

Instantly share code, notes, and snippets.

@ericanderson
Created April 11, 2012 04:06
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 ericanderson/2356781 to your computer and use it in GitHub Desktop.
Save ericanderson/2356781 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ -z `which cc` ]]; then
echo "Please install Xcode from the app store, then install the command line tools."
read -p "Press enter when done"
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
fi
if [[ -z `which gcc-4.2` ]]; then
echo "Installing gcc 4.2 w/o LLVM for later happiness"
mkdir ~/tmp/
cd ~/tmp/
curl -fkLsSO http://opensource.apple.com/tarballs/gcc/gcc-5666.3.tar.gz
tar zxf gcc-5666.3.tar.gz
cd gcc-5666.3
# Setup some stuff it requires
mkdir -p build/obj build/dst build/sym
# And then build it. You should go make a cup of tea or five whilst this runs.
gnumake install RC_OS=macos RC_ARCHS='i386 x86_64' TARGETS='i386 x86_64' \
SRCROOT=`pwd` OBJROOT=`pwd`/build/obj DSTROOT=`pwd`/build/dst SYMROOT=`pwd`/build/sym
# And finally install it
sudo ditto build/dst /
fi
if [[ -z `which brew` ]]; then
echo "Installing homebrew"
cd
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
fi
brew_it()
{
if [[ -z `which $1` ]]; then
echo "Installing $1"
cd
brew install $1
fi
}
brew_it git
brew_it tmux
brew_it wget
if [[ ! -f ~/.rbenv/bin/rbenv ]]; then
echo "Installing rbenv"
cd
git clone -q git://github.com/sstephenson/rbenv.git .rbenv
fi
if [[ ! -d ~/.rbenv/plugins/ruby-build ]]; then
mkdir -p ~/.rbenv/plugins
cd ~/.rbenv/plugins/
git clone -q git://github.com/sstephenson/ruby-build.git
fi
if [[ ! -d ~/.dotfiles ]]; then
cd
git clone git://github.com/ericanderson/dotfiles.git .dotfiles
cd .dotfiles
/usr/bin/ruby ./install.rb
cd
fi
# Make sure profile is loaded
source .bash_profile
install_ruby()
{
if [[ -z `rbenv versions | grep $1` ]]; then
echo "Installing ruby $1"
rbenv install $1
fi
}
install_ruby "1.9.2-p318"
install_ruby "1.8.7-p358"
install_ruby "jruby-1.7.0-dev"
install_ruby "jruby-1.6.7"
if [[ ! -z /Applications/Dropbox.app ]]; then
wget -q -O ~/Downloads/Dropbox.dmg https://www.dropbox.com/download?plat=mac
hdiutil attach -mountpoint /Volumes/Dropbox ~/Downloads/Dropbox.dmg
cp -r /Volumes/Dropbox/Dropbox.app /Applications/
echo "Ignore the error about site.py. Its not a real issue."
hdiutil detach /Volumes/Dropbox
fi
echo
echo "Done."
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment