My laptop setup

After setting myself up on four laptops in the space of two years, I figured it was time to write this all down. Mike Gelbart’s setup has been useful to me, so maybe mine will be useful to you.

macOS preferences

  1. Enable tap to click.
    • System PreferencesTrackpad
    • Check Tap to click
  2. Set mouse speed to maximum.
    • System PreferencesTrackpad
    • Set Tracking Speed to Fast
  3. Enable 3-finger drag.
    • System PreferencesTrackpadAccessibilityMouse & TrackpadTrackpad Options
    • Check Enable dragging with three finger drag
  4. Configure hot corners.
    • System PreferencesTrackpadHot Corners
    • Top left: Desktop
    • Top right: Mission Control
    • Bottom left: Put Display to Sleep
    • Bottom right: Launchpad
  5. Turn on Night Shift.
    • System PreferencesDisplaysNight Shift
    • Set schedule to Sunset to Sunrise

Installations

  1. developer tools: xcode-select --install
  2. 1Password
  3. Chrome
  4. Dropbox
  5. Quicksilver
  6. iTerm2
  7. Homebrew
  8. R
  9. RStudio
  10. Anaconda
  11. Typora
  12. Visual Studio Code
  13. Spotify

iTerm2 configurations

  1. Set the default typing style to Natural:
    • PreferencesProfilesKeys
    • Set Load preset to Natural Text Editing
  2. Set new windows/tabs to open from previous session’s directory:
    • PreferencesProfilesGeneral
    • Under Working Directory, check Reuse previous session's directory

Bash aliases

Put the following in .bash_profile:

alias tp="open -a typora"
alias rst="open -a rstudio"
alias vs="open -a 'visual studio code'"
alias prev="open -a preview"

SSH

Instructions

ssh-add -K ~/.ssh/id_rsa to store passphrase in Keychain.

Then add the following to ~/.ssh/config:

Host *
  UseKeychain yes
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_rsa

Git

Configure my user.

git config --global user.name "David Laing"
git config --global user.email davidkendalllaing@gmail.com

Create a global gitignore file.

touch ~/.gitignore_global

Put this in it:

.DS_Store
.ipynb_checkpoints
.Trashes
.RHistory
.RData
__pycache__

Set up git aliases.

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status

Set up tab completion for git branches.

curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

Add this to .bash_profile:

if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

Run chmod -X ~/.git-completion.bash, and restart iTerm2.

RStudio configurations

Change the default RStudio pane layout.

  • PreferencesPane Layout
  • Top left: Source
  • Top right: Console
  • Bottom left: History
  • Bottom right: everything else

Add a margin line.

  • PreferencesCodeDisplay
  • Check Show margin

Remove the default to save .RData.

  • PreferencesGeneral
  • Uncheck Restore .RData into workspace at startup
  • Change Save workspace to .RData on exit to Never

Set up keyboard shortcuts.

  • PreferencesCodeEditingModify Keyboard Shortcuts
  • Open Previous Tab: Alt+Cmd+Left
  • Open Next Tab: Alt+Cmd+Right
  • Move focus to source: Cmd+1
  • Move focus to console: Cmd+2
  • Move focus to terminal: Cmd+3

Create custom snippets.

  • PreferencesCodeEdit Snippets
  • Add these:
snippet pview
	{View(.); .}

snippet pprint
	{print(.); .}

Jekyll

Install rbenv

(So you don’t have to alter the version of Ruby that comes with Mac.)

# Install rbenv and ruby-build
brew install rbenv

# Setup rbenv integration to your shell
rbenv init

# Check your install
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash

# Install a new version of Ruby
rbenv install 2.5.3
rbenv global 2.5.3
ruby -v

Install Jekyll

This post was useful, as was this issue comment.

gem install bundler
bundle install

To build a site:

bundle exec jekyll build

To test it locally:

bundle exec jekyll serve

Author | David Laing

Data scientist at Imbellus and lecturer in the Master of Data Science program at the University of British Columbia.