Skip to content

Instantly share code, notes, and snippets.

Last active Jul 23, 2021
What would you like to do?
New macOS Setup

Old machine

  • Backup alfred preferences: cp '/Users/matt/Library/Application Support/Alfred/Alfred.alfredpreferences/preferences/features/websearch/prefs.plist' config:/alfred/websearch-prefs.plist
  • Backup iterm preferences (Profile, keymap, colors)
  • TODO roll all this into a script


Generate new key(s)

ssh-keygen -t rsa -b 4096 -C "$(whoami)@$(hostname)"
ssh-keygen -o -a 100 -t ed25519 -C "$(whoami)@$(hostname)"

Store passphrase in agent

Put this at the top of ~/.ssh/config

Host *
  # For macOS agent
  IgnoreUnknown UseKeychain
  UseKeychain yes
  AddKeysToAgent yes
  # General purpose
  ServerAliveInterval 60
  TCPKeepAlive yes


Install homebrew

/usr/bin/ruby -e "$(curl -fsSL"

Install applications

# General purpose
brew cask install firefox
brew cask install iterm2
brew cask install keepassxc
brew cask install alfred
brew cask install dropbox
brew cask install spectacle
brew cask install flux
brew cask install spotify
brew cask install google-chrome
brew install restic
brew cask install authy
brew install joplin (terminal)  # Not using this yet
brew cask install joplin (gui)  # Not using this yet

# Development
brew install bash
brew cask install docker
brew install git
brew install coreutils
brew install gnu-sed
brew install thefuck
brew cask install cyberduck
brew install the_silver_searcher

# Audio
brew cask install soundflower # Needs kernel permissions

Mac App Store

brew install mas
mas install $(mas search amphetamine | head -n 1 | awk '{print $1}')
mas install $(mas search todoist | head -n 1 | awk '{print $1}')
mas install $(mas search 'grand perspective' | head -n 1 | awk '{print $1}')
mas install $(mas search trello | head -n 1 | awk '{print $1}')

Manual installs

  1. Keybase -

  2. Aerial Screensaver -

  3. Krypton CLI - brew install kryptco/tap/kr

  4. Krypton Firefox Extension -



# General purpose
alias home='cd /Users/matt'
alias cal9='cal -A4 -B4'
alias cal27='cal -A13 -B13'
alias cpwd='pwd | tr -d "\n" | pbcopy'
alias cpip='wanip | tr -d "\n" | pbcopy'
alias wanip='dig +short'
alias weather='curl -s | grep -v feature | grep -v igor_chubin'
alias la='ls -lA'
alias ls='ls -G'

# macOS
alias delete_ds_store='find . -name '\''.DS_Store'\'' -type f -delete'
alias find_ds_store='find . -name '\''.DS_Store'\'' -type f'
alias finder='open .'

# Development
alias gctc='gradle clean test checkstyleall'
alias gctci='gradle clean test checkstyleall integrationtest checkstyleintegrationtest'
alias shebang='echo '\''#!/usr/bin/env bash'\'''

# Privacy
alias hosts_adblock='sudo rm -f /etc/hosts; sudo cp /etc/hosts_adblock /etc/hosts'
alias hosts_simple='sudo rm -f /etc/hosts; sudo cp /etc/hosts_simple /etc/hosts'


# What branches do I have that origin doesn't?
git_branches_not_on_origin() {
    git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}'

# cd to deepest directory of an absolute file path #
cdfile() {
    cd -- "$(dirname $1)";

cdmktemp() {
    cd $(mktemp -d)

# make a directory and cd to it #
mcd() {
    test -d "$1" || mkdir "$1" && cd "$1"

# octal permissions on ls
lso() {
  ls -l "$@" | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(" %0o ",k);print}';

# sha256sum #
sha256sum() {
  openssl sha256 "$@" | awk '{print $2}';

# Recursively get absolute paths for all files and directories in a given directory
fulltree() {
  ls -R "$1" | awk '/:$/&&f{s=$0;f=0}/:$/&&!f{sub(/:$/,"");s=$0;f=1;next}NF&&f{ print s"/"$0 }'

# Bash history

System Preferences

These can apparently be done (mostly? completely?) via command line executables/scripts:


  1. Invert trackpad scrolling
  2. Turn on three-finger drag (accessibility)
  3. Turn on silent clicking
  4. Turn on tap-to-click


  1. Pick a name for the machine


  1. Tick show keyboard and emoji viewer in menu bar
  2. Use F1, F2, etc. keys as standard function keys
  3. Key repeat: Maximum speed
  4. Delay until repeat: Second shortest

Application Preferences


  • Get from back-up


  • Add home folder to favourites
  • Use home folder as default Finder location
  • Show all filename extensions
  • Keep folders on top in windows when sorting by name
  • Keep folders on top on desktop
  • View -> Show Status Bar


  • Import web shortcuts from backup ???


  • Import preferences from config:/iterm
  • Import keymap from config:/iterm


  • Preferences -> Profiles -> Shell -> When the shell exits -> Close the window


  • Keep messages for one year
  • Untick being reachable on email address
  • Untick read receipts


  • Tick lock database when session locked or lid closed
  • Tick hide the entry preview panel


  • Remove 'Center' shortcut (it's too useful elsewhere)


  • Set up (it's in code/github/something)


  • System Preferences -> Security & Privacy -> Full Disk Access -> Add iTerm (needed to write into ~/Pictures/Photos Library.photolibrary)
  • Restore everything from NAS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment