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

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 Homebrew binaries and casks.

# Create sbin directory and set permissions.
sudo mkdir -p /usr/local/sbin
sudo chown -R $(whoami) /usr/local/sbin

# 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 cask ====
# These apps have permission issues with non-admin accounts:
# - carbon-copy-cloner
# - dropbox
# - little-snitch
# - slack

# Priority
brew cask install java osxfuse xquartz

brew cask install 1password
brew cask install alfred
brew cask install aspera-connect
brew cask install atom
brew cask install authy
brew cask install basictex
brew cask install bbedit
brew cask install bibdesk
brew cask install coconutbattery
brew cask install coda
brew cask install docker
brew cask install emacs
brew cask install fiji
brew cask install firefox
brew cask install github
brew cask install google-chrome
brew cask install google-cloud-sdk
brew cask install google-drive-file-stream
brew cask install gpg-suite
brew cask install hazel
brew cask install igv
brew cask install iterm2
brew cask install keka
brew cask install kid3
brew cask install libreoffice
brew cask install omnidisksweeper
brew cask install onyx
brew cask install r-app
brew cask install rstudio
brew cask install safari-technology-preview
brew cask install skype
brew cask install spillo
# License is expensive. Use BBEdit, Atom, VS Studio Code.
# brew cask install sublime-text
brew cask install superduper
brew cask install torbrowser
# License is too expensive, use Visual Studio Code + GitLens.
# brew cask install tower
brew cask install transmit
brew cask install tunnelblick
brew cask install visual-studio-code
brew cask install vlc
brew cask install xld
# Note that v2.7.11 doesn't work well with wine.
# Install v2.7.9 directly instead.
# https://www.xquartz.org/releases/XQuartz-2.7.9.html
# brew cask install xquartz
brew cask install wine-devel

# brew ====
# Homebrew now supports a global variable to force bottle installations.
# Alternatively, can use `--force-bottle`.
# See also:
# - https://github.com/Homebrew/brew/pull/4520/files
# - https://github.com/Homebrew/brew/pull/4542/files
export HOMEBREW_FORCE_BOTTLE="1"

# Use CRAN R (r-app cask) instead of Homebrew R.

# Priority
brew install flac lame tcl-tk

# Shells
brew install bash fish ksh tcsh zsh

brew install autoconf
brew install automake
brew install bash-completion
# Requires Java 1.7+.
brew install bfg
brew install ccache
brew install circleci
brew install cmake
brew install convmv
brew install coreutils
brew install curl
# Modern replacement for ls.
brew install exa
brew install exiftool
brew install ffmpeg
brew install findutils
brew install flac
brew install gcc
brew install gdal
brew install git
brew install git-lfs
brew install gsl
# Reinstall from source if you see this:
# Warning: hdf5 dependency gcc was built with a different C++ standard
# library (libstdc++ from clang). This may cause problems at runtime.
# brew reinstall hdf5 --build-from-source
# Otherwise hdf5 in R can have issues.
brew install hdf5
brew install hub
# --with-ghostscript --with-pango --with-webpbrew
brew install imagemagick --with-fontconfig --with-librsvg
brew install leiningen
brew install libav
brew install libgit2
brew install libiconv
brew install libressl
brew install librsvg
brew install libssh2
brew install libxml2
brew install libxslt
# Full mainline: --with-toolchain (very slow)
brew install llvm
# Use instead of mysql.
brew install mariadb-connector-c
brew install mas
brew install md5sha1sum  # md5sum
brew install neovim
brew install node
# CPU intensive if built from source.
brew install openblas --with-openmp
brew install pandoc
brew install pandoc-citeproc
brew install pandoc-crossref
brew install pkg-config
brew install protobuf
brew install python --with-tcl-tk
brew install rsync
brew install rbenv
brew install screen
brew install shellcheck
brew install sshfs
brew install sox --with-flac --with-lame
brew install tesseract
brew install tmux
brew install trash
brew install tree
brew install udunits
brew install vim
brew install wget
brew install winetricks
brew install youtube-dl
brew install zlib

# Cask repair (for pull requests)
brew install vitorgalvao/tiny-scripts/cask-repair

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

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

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