Skip to content

Instantly share code, notes, and snippets.

@tombennett
Forked from codeinthehole/osx_bootstrap.sh
Last active January 25, 2020 23:03
Show Gist options
  • Save tombennett/36b31eaf995b6d1d95979f3239143047 to your computer and use it in GitHub Desktop.
Save tombennett/36b31eaf995b6d1d95979f3239143047 to your computer and use it in GitHub Desktop.
OSX bootstrap
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - annotate (appstore)
# - office for mac 2016
#
# Notes:
#
# - If installing full Xcode, it's better to install that first from the app
# store before running the bootstrap script. Otherwise, Homebrew can't access
# the Xcode libraries as the agreement hasn't been accepted yet.
#
# Reading:
#
# - https://github.com/lra/mackup
# - http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac
# - https://gist.github.com/MatthewMueller/e22d9840f9ea2fee4716
# - https://news.ycombinator.com/item?id=8402079
# - http://notes.jerzygangi.com/the-best-pgp-tutorial-for-mac-os-x-ever/
# - https://gist.github.com/todc/9562086
echo "Starting bootstrapping"
# Check for Homebrew, install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Update homebrew recipes
brew update
PACKAGES=(
awscli
git
go
jq
python
terraform
vault
mackup
)
echo "Installing packages..."
brew install ${PACKAGES[@]}
echo "Cleaning up..."
brew cleanup
echo "Installing cask..."
brew tap caskroom/cask
#brew install caskroom/cask/brew-cask
CASKS=(
launchbar
dropbox
evernote
google-drive-file-stream
iterm2
powershell
visual-studio-code
royal-tsx
hazel
keepingyouawake
)
echo "Installing cask apps..."
brew cask install ${CASKS[@]}
echo "Configuring OSX..."
# Show filename extensions by default
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Disable "natural" scroll
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
# Show battery percentage
defaults write com.apple.menuextra.battery ShowPercent YES
# Set dock preferences
defaults write com.apple.dock 'orientation' -string 'left'
defaults write com.apple.dock tilesize -int 16
defaults write com.apple.dock magnification -bool true
defaults write com.apple.dock mineffect -string 'genie'
killall Dock
# Restore config from mackup
echo "Restoring config from mackup"
mackup restore
echo "Bootstrapping complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment