Skip to content

Instantly share code, notes, and snippets.

@hannu
Created April 24, 2012 13:58
Show Gist options
  • Save hannu/2479865 to your computer and use it in GitHub Desktop.
Save hannu/2479865 to your computer and use it in GitHub Desktop.
Development environment installation script for OS X
#!/usr/bin/env bash
# Development environmet installation script for OS X
# This script will
# - Install Homebrew (http://mxcl.github.com/homebrew/)
# - Install GIT
# - Run GIT/GitHub setup script (https://github.com/help/setup)
# - Setups default global .gitignore file
# - Install Oh-My-ZSH (https://github.com/robbyrussell/oh-my-zsh)
# - Install Ruby Version Manager (http://beginrescueend.com/)
# - Create Sublime Text 2 cmd line symlink if editor is installed
# - Set group of OS X defaults
# Install homebrew
echo "Installing Homebrew"
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
echo "Installing GIT"
/usr/local/bin/brew install git
# Cloning and running GitHub setup.sh
git clone https://github.com/help/setup.git github-setup
github-setup/setup.sh
rm -rf github-setup
# Create global .gitignore
echo "Creating global .gitignore"
if [ -f ~/.gitignore ]; then
read -n1 -p "Overwrite ~/.gitignore? "
echo ""
else
REPLY=y
fi
if [[ $REPLY = [yY] ]]; then
cat >~/.gitignore <<EOL
.DS_Store
.Trashes
*~
*.o
*.so
*.log
EOL
git config --global core.excludesfile ~/.gitignore
fi
# Install oh-my-zsh
echo "Installing Oh-My-ZSH"
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
# Install RVM
echo "Installing Ruby Version Manager"
curl -L https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
# Create subl symlink if Sublime Text 2 is installed
if [[ -f "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" && ! -f /usr/bin/subl ]]; then
echo "Symlinking Sublime Text 2 command line binary"
echo "Enter your password to create /usr/bin/subl symlink"
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
fi
# Set OS X defaults
echo "Setting OS X defaults"
# (Picked from https://github.com/mathiasbynens/dotfiles/blob/master/.osx)
# Show remaining battery time; hide percentage
defaults write com.apple.menuextra.battery ShowPercent -string "NO"
defaults write com.apple.menuextra.battery ShowTime -string "YES"
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
# Disable Resume system-wide
defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false
# Show all filename extensions in Finder
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Show indicator lights for open applications in the Dock
defaults write com.apple.dock show-process-indicators -bool true
# Enable the 2D Dock
defaults write com.apple.dock no-glass -bool true
# Disable all the other Ping stuff in iTunes
defaults write com.apple.iTunes disablePing -bool true
# Disable send and reply animations in Mail.app
defaults write com.apple.Mail DisableReplyAnimations -bool true
defaults write com.apple.Mail DisableSendAnimations -bool true
# Kill affected applications
for app in Finder Dock Mail iTunes SystemUIServer; do killall "$app" > /dev/null 2>&1; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment