cjohnson496
12/18/2016 - 5:59 AM

macOS 10.12 Sierra Setup

macOS 10.12 Sierra Setup

tap 'caskroom/cask'
tap 'homebrew/bundle'
tap 'homebrew/core'
tap 'homebrew/services'
brew 'git'
brew 'git-flow'
brew 'mas'
brew 'mysql'
cask 'adobe-creative-cloud'
cask 'atom'
cask 'dropbox'
cask 'firefox'
cask 'github-desktop'
cask 'google-chrome'
cask 'iterm2'
cask 'sketch'
cask 'skype'
mas 'iMovie', id: 408981434
mas 'Pages', id: 409201541
mas 'Slack', id: 803453959
mas 'Numbers', id: 409203825
mas 'Better', id: 1121192229
mas 'Twitter', id: 409789998
mas '1Password', id: 443987910 
mas 'OmniFocus', id: 867299399 
mas 'Polymail', id: 1134717305 
mas 'Airmail 3', id: 918858936 
mas 'Keynote', id: 409183694 
mas 'Harvest', id: 506189836 
mas 'Telegram', id: 747648890 

macOS 10.12 Sierra Setup

Custom recipe to get macOS 10.12 Sierra running from scratch, setup applications and developer environment. T

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install.

Install OS X

  • Make backup
  • Download Sierra installer
  • Format USB Stick, name it Sierra
  • Copy the Sierra installer onto the stick
sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/Sierra --applicationpath /Applications/Install\ macOS\ Sierra.app --nointeraction

Install Software

The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.

Prerequisites

Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Mac App Store Command Line Tools

The mas command by argon is a handy tool to interact with the App Store without needing to point and click, search, and otherwise need manual intervention. This lets us install the next batch of software very quickly using Terminal.

Now that Homebrew is installed, it's easy to get mas:

brew install mas

Then signin to the Mac App Store for the first time:

mas signin YOUR@EMAIL.COM

Install binaries from a Brewfile (apps from App Store using mas, apps from Cask)

Retrieve Brewfile

curl -o Brewfile https://gist.githubusercontent.com/gillesdemarty/dc5dd9db503702ec1a7abfe15f3a4897/raw/b176f434ae7f52b0b8e9b5f6593406837aaaa1a0/2-macOS-10.12-sierra-setup-brewfile

Edit Brewfile for last minute changes

You may wish to add or remove a few App Store or Cask items before initiating Homebrew to install all of the applications. If you wish to review these now you may examine the Brewfile now.

Install apps

brew bundle install

This will take some time, especially if you have a slow internet connection and because Xcode is huge. But it's faster than you having to search the App Store app and click to install for each of these!

Shell

Install custom .dotfiles

git clone git@github.com:kevinelliott/.dotfiles.git ~/.dotfiles
~/.dotfiles/install.sh

Update .bash_profile

echo 'source ~/.dotfiles/base.sh' >> ~/.bash_profile

OS X Preferences


#Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0.02

#Set a shorter Delay until key repeat
defaults write NSGlobalDomain InitialKeyRepeat -int 12

#Add a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true

#Show the ~/Library folder
chflags nohidden ~/Library

#Store screenshots in subfolder on desktop
mkdir ~/Desktop/Screenshots
defaults write com.apple.screencapture location ~/Desktop/Screenshots

Set hostname

sudo scutil --set HostName SpaceX-Falcon-9

#Git

Setup Github

ssh-keygen -t rsa -C "kevin@welikeinc.com"

# Copy ssh key to github.com
subl ~/.ssh/id_rsa.pub

# Test connection
ssh -T git@github.com

# Set git config values
git config --global user.name "Gilles Demarty"
git config --global user.email "gilles.demarty@gmail.com"
git config --global github.user gillesdemarty
git config --global github.token your_token_here

git config --global core.editor "subl -w"
git config --global color.ui true

Server

MySQL

brew install mysql
brew pin mysql

MySQL Settings

# Copy launch agent into place
mkdir -p ~/Library/LaunchAgents && cp /usr/local/Cellar/mysql/VERSION/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/

# Edit launch agent and set both keepalive and launch at startup to false
vi ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

# Inject launch agent
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

# Set up databases to run as your user account
unset TMPDIR && mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

# Start mysql
start mysql

# Secure mysql
/usr/local/Cellar/mysql/VERSION/bin/mysql_secure_installation

PostgreSQL

brew install postgres --no-ossp-uuid
brew pin postgres

PostgreSQL Settings

# Initialize db if none exists already
initdb /usr/local/var/postgres

# Create launchctl script
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/VERSION/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/

# Edit launchctl script (set to not start automatically and keepalive false)
subl ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

# Inject launchctl script
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

# Start PostgreSQL
start pg