Create a gist now

Instantly share code, notes, and snippets.

Automate the OSX setup process (eg: you got a new Mac)
#!/bin/sh
echo "\nHello, I will make your Mac awesome"
sudo -v
# Keep-alive sudo
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
echo "-------------------------"
echo "| Binaries |"
echo "-------------------------"
binaries=(node git zsh)
apps=(
iterm2
sublime-text3
dropbox
slack
transmission
google-chrome
skype
spotify
)
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
echo "Update brew recipes..."
brew update
echo "Installing GNU core utilities..."
brew install coreutils
echo "Installing findutils..."
brew install findutils
for i in "${binaries[@]}"
do
echo "Installing $i"
brew install $i
done
echo "Retrieve gitconfig..."
curl https://rawgit.com/yadomi/dotfiles/master/gitconfig > ~/.gitconfig
echo "Setting up ZSH...";
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
chsh -s /bin/zsh
echo "Tyding up homebrew..."
brew cleanup
echo "-------------------------"
echo "| Apps |"
echo "-------------------------"
echo "Install Cask for more fun..."
brew install caskroom/cask/brew-cask
echo "Adding beta channel to Cask..."
brew tap caskroom/versions
for i in "${apps[@]}"
do
echo "Installing $i to /Applications"
brew cask install --appdir="/Applications" $i
done
echo "-------------------------"
echo "| OSX Defaults |"
echo "-------------------------"
echo "Expanding the save panel by default"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
echo "Saving to disk (not to iCloud) by default"
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
echo "Showing status bar in Finder by default"
defaults write com.apple.finder ShowStatusBar -bool true
echo "Use column view in all Finder windows by default"
defaults write com.apple.finder FXPreferredViewStyle Clmv
echo "Avoiding the creation of .DS_Store files on network volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
echo "Allowing text selection in Quick Look/Preview in Finder by default"
defaults write com.apple.finder QLEnableTextSelection -bool true
echo "No more transparency !"
defaults write com.apple.universalaccess reduceTransparency -bool true
echo "Done !"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment