d3trax
9/20/2016 - 9:05 AM

macOS 10.12 Sierra Setup

macOS 10.12 Sierra Setup

# load zgen
ZGEN_PREZTO_LOAD_DEFAULT=0
source "${HOME}/.zgen/zgen.zsh"

# if the init scipt doesn't exist
if ! zgen saved; then
    echo "Creating a zgen save"

    zgen prezto prompt theme 'sorin'
    #zgen prezto tmux:auto-start local 'yes'
    zgen prezto editor key-bindings 'vi'
    zgen prezto utility:ls color 'yes'
    zgen prezto '*:*' case-sensitive 'yes'
    zgen prezto '*:*' color 'yes'

    zgen prezto
    zgen prezto git
    zgen prezto environment
    zgen prezto terminal
    zgen prezto editor
    zgen prezto directory
    zgen prezto spectrum
    zgen prezto utility
    zgen prezto prompt
    zgen prezto archive
    zgen prezto ruby
    zgen prezto rails

    zgen prezto command-not-found
    #zgen prezto tmux
    zgen prezto fasd
    zgen prezto history-substring-search
    zgen prezto syntax-highlighting

    zgen load m42e/prezto_extras
    
    zgen load caarlos0/zsh-git-sync
    zgen load TBSliver/zsh-plugin-colored-man
    zgen load mafredri/zsh-async
    zgen load junegunn/fzf shell
    
    zgen load zsh-users/zsh-syntax-highlighting
    zgen load tarruda/zsh-autosuggestions

    zgen save
fi

autoload -Uz add-zsh-hook
add-zsh-hook precmd newline-after-command

function newline-after-command() { 
  print ''
}

export FZF_COMPLETION_TRIGGER=''
bindkey '^T' fzf-completion

##################

# Node
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh

# Ruby
export PATH="$PATH:$HOME/.rvm/bin"

# Git / Github
export GITHUB_USERNAME=kevinelliott
alias git-prune="git branch --merged master | grep -v \"\* master\" | grep -v \" master\" | xargs -n 1 git branch -d"

# Install zgen
git clone https://github.com/tarjoilija/zgen.git "${HOME}/.zgen"

# Setup ~/.zshrc
curl -o ~/.zshrc https://gist.githubusercontent.com/kevinelliott/7a152c556a83b322e0a8cd2df128235c/raw/4769f610f0863e6f9f2783c278947ff6055ce9b5/4-dotfile-zshrc

# Run ZSH so that everything initializes
zsh

# Change user shell to zsh
chsh

# Setup RVM
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
echo progress-bar > ~/.curlrc
curl -sSL https://get.rvm.io | bash

# Install Ruby
rvm install 2.3

# Install powder/pow
gem install powder
powder install

# Setup symbolic link to cloud backed work dir
ln -s Cloud/Dropbox/work ~/work
tap "caskroom/cask"
tap "caskroom/drivers"
tap "caskroom/fonts"
tap "homebrew/bundle"
tap "homebrew/core"
tap "homebrew/fuse"
tap "homebrew/science"
tap "homebrew/services"
tap "mapbox/cli"
tap "pothosware/pothos"
cask "osxfuse"
brew "ack"
brew "readline"
brew "asciinema"
brew "autoconf"
brew "autojump"
brew "automake"
brew "isl"
brew "mpfr"
brew "libmpc"
brew "gcc"
brew "p7zip"
brew "ssdeep"
brew "binwalk"
brew "freetype"
brew "gettext"
brew "colordiff"
brew "coreutils"
brew "curl"
brew "libgpg-error"
brew "libassuan"
brew "libgcrypt"
brew "libksba"
brew "pth"
brew "dirmngr"
brew "foremost"
brew "git"
brew "fzf"
brew "git-flow"
brew "git-standup"
brew "pinentry"
brew "gnupg"
brew "go"
brew "gpg-agent"
brew "gx"
brew "gx-go"
brew "heroku"
brew "htop"
brew "hub"
brew "icoutils"
brew "icu4c"
brew "jpeg"
brew "libtool"
brew "imagemagick"
brew "ipfs"
brew "libevent"
brew "memcached"
brew "libmemcached"
brew "libusb-compat"
brew "libxml2"
brew "libyaml"
brew "mas"
brew "openssl@1.1"
brew "protobuf"
brew "mitmproxy"
brew "mobile-shell"
brew "mtr"
brew "mysql"
brew "nmap"
brew "node"
brew "nvm"
brew "ossp-uuid"
brew "pkg-config"
brew "python"
brew "postgresql", restart_service: true
brew "qemu"
brew "speedtest_cli"
brew "sshfs"
brew "sslsplit"
brew "tcpflow"
brew "tmux"
brew "utf8proc"
brew "wget"
cask "adobe-creative-cloud"
cask "amazon-drive"
cask "amazon-music"
cask "android-studio"
cask "anvil"
cask "atom"
cask "boinc"
cask "cocoapods-app"
cask "discord"
cask "docker-toolbox"
cask "dropbox"
cask "firefox"
cask "font-hack-nerd-font"
cask "font-menlo-for-powerline"
cask "github-desktop"
cask "google-chrome"
cask "google-earth"
cask "grandperspective"
cask "hipchat"
cask "hyper"
cask "iterm2"
cask "java"
cask "joinme"
cask "keybase"
cask "little-snitch"
cask "livereload"
cask "lunchy"
cask "macdown"
cask "mono-mdk"
cask "ngrok"
cask "obs"
cask "opera"
cask "parallels-desktop"
cask "rescuetime"
cask "sidestep"
cask "sketch"
cask "skitch"
cask "skype"
cask "sonos"
cask "soundflower"
cask "spotify"
cask "steam"
cask "sublime-text"
cask "transmit"
cask "visual-studio"
cask "visual-studio-code"
cask "vlc"
cask "wdfirmwareupdater"
mas "Blackmagic Disk Speed Test", id: 425264550
mas "CARROT Weather", id: 993487541
mas "CCMenu", id: 603117688
mas "DrCleaner", id: 921458519
mas "Frame.io", id: 992958444
mas "iMovie", id: 408981434
mas "Magnet", id: 441258766
mas "QuickBooks", id: 640830064
mas "Slack", id: 803453959
mas "WiFi Explorer", id: 494803304
mas "WiFi Signal", id: 525912054
mas "Xcode", id: 497799835

macOS 10.12 Sierra Setup

Custom recipe to get macOS 10.12 Sierra running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.11 El Capitan setup recipe and 10.10 Yosemite setup recipe. I am currently tweaking this for 10.12 Sierra and expect to refine this gist over the next few weeks.

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. I generally reinstall each computer from scratch every 6 months, and I do not perform upgrades between releases.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

If you find it useful: feel free to shoot me an email, leave a comment, or tell others about it.

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)"

Xcode Command Line Tools

During install of Homebrew, the script will kindly detect that you have not yet installed Xcode Command Line Tools, and pop up a dialog asking if you want to install it. Yes, you do. I defer to install the full Xcode until later since the download takes longer and I want to keep moving forward. For now, just the Xcode Command Line Tools.

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 (if you are already signed in, then it will tell you):

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/kevinelliott/7a152c556a83b322e0a8cd2df128235c/raw/272051580590bb57685ca9f40939e056e3f9f055/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!

Confirm the Xcode license if you left Xcode in the Brewfile:

sudo xcodebuild -license

Install from Third-Party Websites

Fonts

Mensch coding font

Xcode Command Line Tools

Xcode > Preferences > Downloads > Command Line Tools

Homebrew

Install Parallels plugin for Vagrant

vagrant plugin install vagrant-parallels

See http://parallels.github.io/vagrant-parallels/ for more details.

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 1

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

#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 "Kevin Elliott"
git config --global user.email "kevin@welikeinc.com"
git config --global github.user kevinelliott
git config --global github.token your_token_here

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

Sublime Text

Add Sublime Text CLI

This is done automatically by Homebrew Cask.

Install Package Control

Run Sublime Text 3 and access the console via the CTRL + ``` shortcut or theView > Show Console` menu.

import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

See https://sublime.wbond.net/installation for more information. Their site has a note that this install code will change for each new release, so it would be good to check once in a while.

Install Packages

BracketHighlighter CoffeeScriptHaml

Install Soda Theme

git clone git://github.com/buymeasoda/soda-theme.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Theme\ -\ Soda

Install Tomorrow Theme

git clone git://github.com/chriskempson/textmate-tomorrow-theme.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Color\ Scheme\ -\ Tomorrow

Settings

Sublime Text > Preferences > Settings - User

{
  "bold_folder_labels": true,
  "close_windows_when_empty": true,
  "color_scheme": "Packages/User/SublimeLinter/Monokai-Cobalt (SL).tmTheme",
  "draw_indent_guides": false,
  "fade_fold_buttons": false,
  "font_face": "Source Code Pro",
  "font_size": 16,
  "highlight_line": true,
  "highlight_modified_tabs": true,
  "ignored_packages":
  [
    "Vintage"
  ],
  "show_tab_close_buttons": false,
  "spell_check": false,
  "tab_size": 2,
  "translate_tabs_to_spaces": true,
  "theme": "Soda Light.sublime-theme",
  "word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?",
  "word_wrap": true
}

Key Bindings

[
    { "keys": ["super+b"], "command": "expand_selection", "args": {"to": "brackets"} },
    { "keys": ["super+f"], "command": "show_panel", "args": {"panel": "replace"} },
    { "keys": ["super+alt+f"], "command": "show_panel", "args": {"panel": "find"} }
]

Snippets

git clone git@github.com:bytestudios/sublime-snippets.git "/Users/Joel/Library/Application Support/Sublime Text 2/Packages/Byte"