Install macOS

How to make that Mac feel new again.

Preferences and settings

Monospace fonts

Color palettes

Download the base16 templates:

Ocean is the preferred color scheme.

Download our Coda.app and Terminal.app profiles.

Atom

r-exec enables the user to run R code directly from Atom.

apm install r-exec

Microsoft Excel

Change system defaults

# Unhide the user library
chflags nohidden ~/Library

# Speed up user interface animations
# http://robservatory.com/speed-up-your-mac-via-hidden-prefs/
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -int 0
defaults write com.apple.finder DisableAllAnimations -bool true
defaults write NSGlobalDomain NSWindowResizeTime .001
killall Dock
killall Finder

# Don't write `.DS_Store` files to network storage
defaults write com.apple.desktopservices DSDontWriteNetworkStores true

# Save screenshots into Documents, instead of Desktop
screenshots_dir="${HOME}/Documents/Screenshots"
mkdir -p "$screenshots_dir"
defaults write com.apple.screencapture disable-shadow -bool true
defaults write com.apple.screencapture location "$screenshots_dir"
defaults write com.apple.screencapture name Screenshot
killall SystemUIServer

# Disable podcasts in iTunes
defaults write com.apple.itunes disablePodcasts -bool YES

Generate an SSH key pair

First, check to see if one already exists.

ls -l ~/.ssh/id_rsa*
# Remove existing keys
rm ~/.ssh/id_rsa*

Create a new keypair.

ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -C <EMAIL>

On macOS Sierra, you have to enable keychain storage in ~/.ssh/config to save your passphrase.

Host *
    UseKeychain yes

Add the newly created private key to the macOS keychain.

ssh-add -K ~/.ssh/id_rsa

Copy the public key to the clipboard.

cat ~/.ssh/id_rsa.pub | pbcopy

Add your newly created public key to the ~/.ssh/authorized_keys file of the remote server. Be sure to ensure the correct permissions of both the remote ~/.ssh folder (700) and ~/.ssh/authorized_keys (600).

Upgrade OpenSSL

macOS ships with an outdated version of OpenSSL. Compile and install the current version.

# Use latest OpenSSL stable release
# https://www.openssl.org/source/
# 1.1.0h (2018-03-27)
cd ~/Downloads
curl -O https://www.openssl.org/source/openssl-1.1.0h.tar.gz
tar -xvzf openssl-*
cd openssl-*
./Configure darwin64-x86_64-cc
make
make test
sudo make install
cd ..
rm -rf openssl-*
# Reload terminal and check version
exit 1
which openssl
openssl version

Install Homebrew

Homebrew is an incredibly useful package and application manager for macOS. It requires Xcode to be installed first from the App Store. Then the default workspace environment can be set up using our custom script.

# Install Xcode CLT.
xcode-select --install

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

# Here's how to uninstall Homebrew (for reference).
# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

# Update Homebrew.
brew update

# brew ====
brews=(flac    # priority
       lame    # priority
       tcl-tk  # priority
       bash
       bfg  # Java 1.7+ is required
       convmv
       coreutils
       curl
       exiftool
       ffmpeg
       findutils
       fish
       flac
       gcc
       gdal
       git
       git-lfs
       gsl
       hdf5
       hub
       imagemagick
       leiningen
       libav
       libgit2
       librsvg
       llvm  # full mainline: --with-toolchain (slow)
       mariadb-connector-c  # use instead of mysql
       mas
       node
       pandoc
       pandoc-citeproc
       pandoc-crossref
       protobuf
       "python --with-tcl-tk"
       rsync
       rbenv
       screen
       sshfs
       "sox --with-flac --with-lame"
       tesseract
       tmux
       trash
       tree
       vim
       wget
       wine
       youtube-dl
       zlib
       zsh)
for brew in ${brews[@]}; do
    brew install "$brew"
done

# brew cask ====
# dropbox has permission issues when installing using login from a non sudo account.
casks=(java     # priority
       osxfuse  # priority
       xquartz  # priority
       1password
       alfred
       atom
       authy
       basictex
       bbedit
       bibdesk
       carbon-copy-cloner
       coconutbattery
       coda
       docker
       emacs
       fiji
       firefox
       github
       google-chrome
       google-cloud-sdk
       google-drive-file-stream
       gpg-suite
       hazel
       igv
       iterm2
       keka
       libreoffice
       little-snitch
       omnidisksweeper
       onyx
       r-app
       rstudio
       skype
       slack
       spillo
       sublime-text
       superduper
       torbrowser
       tower
       transmit
       tunnelblick
       vlc
       xld)
for cask in ${casks[@]}; do
    brew cask install --force "$cask"
done

Note that R should be installed using brew cask install r-app instead of brew install r. This command will install the latest official R.app binary, which has two main advantages: (1) support in the RStudio IDE, and (2) fast downloading of pre-compiled packages from CRAN.

Homebrew needs to be updated on a regular schedule.

brew update
brew upgrade
brew cask outdated | xargs brew cask reinstall

Configure Python

Python is useful for scripting workflows. Homebrew can manage installations of both versions 2 and 3 and the launcher application automatically.

pip install --upgrade pip setuptools
pip3 install --upgrade pip setuptools wheel

Final steps