Setting up M1 MBP

recently got my hands on the new m1 macbook, this thing is stupid fast and makes like zero heat - anyway here's a guide for setting up the following on this new architecture:

  • package manager, homebrew, obviously
  • terminal emulator, kitty
  • shell, fish & fisher
  • pretty good privacy, gnupg
  • node version manager, nvm
  • keybindings daemon, skhd
  • tiling wm, yabai
  • increase key repeat & animation speed across os
  • setup ssh keys for gitlab & github

open up and follow along :)

brew, kitty, fish & nvm

# get homebrew
/bin/bash -c "$(curl -fsSL"

# get kitty terminal
brew install --cask kitty

# get my kitty config & add to .config
mkdir ~/.config/kitty
curl >> ~/.config/kitty/kitty.conf

# install fish shell via homebrew
brew install fish

# check it works

# get the path of fish installation, varies depending on intel or m1
# for m1s all homebrew packages are at /opt/homebrew
# for intel its /usr/local/bin
which fish

# add this path to /etc/shells
sudo nano /etc/shells

# set default shell to fish
chsh -s `which fish`

# install fisher plugin manager & nvm
curl -sL | source && fisher install jorgebucaran/fisher
fisher install jorgebucaran/

# install latest node & persist across terminals in $PATH
nvm install latest

# install nvm omf package with fisher
# will set PATH vars to persist nvm/node across new shells
fisher install oh-my-fish/nvm

# use node
nvm list
nvm use latest

# done!
node -v

# install gnupug
brew install gnupg

yabai & skhd

for big sur you have to remove System Integrity Protection to allow for the scription addition of yabai (this is useful for skhd), you enter recovery mode by first turning off your mac, and then holding the power button until you see the apple logo & some text that says "loading options..." or something along those lines, & then clicking the "Options" icon once prompted

# once inside recovery mode, open up a terminal from the Utilities section in the top bar
csrutil disable --with kext --with dtrace --with basesystem

# now reboot

once back into your normal system

# add this boot arg to allow for application binary interface
sudo nvram boot-args=-arm64e_preview_abi
# reboot again

after rebooting & logging in once again

# install keyboard daemon for keyinding yabai scripts
brew install koekeishiya/formulae/skhd

# get my skhd config
curl >> ~/.skhdrc
brew services start skhd

# install yabai fork which works with big sur
brew install --HEAD xorpse/formulae/yabai
# install & load scripting add-on
sudo yabai --install-sa
sudo yabai --load-sa

# get my yabai config which has code for loading the scripting add-on every time yabai starts
# as well as starting skhd as a daemon
mkdir ~/.config/yabai
curl >> ~/.config/yabai/yabairc

# as one final step we need to give this script sudo permissions to automatically start the scripting add-on
# see
sudo visudo -f /private/etc/sudoers.d/yabai

# add one of these lines to that file
# change yabai path according to cpu type, /opt/homebrew is for M1
# YOUR_USERNAME ALL = (root) NOPASSWD: /usr/local/bin/yabai --load-sa
# YOUR_USERNAME ALL = (root) NOPASSWD: /opt/homebrew/bin/yabai --load-sa

source for some of this part:

overwriting some defaults

increase dock show speed & reduce animation time

defaults write autohide-time-modifier -float 0.3;killall Dock
defaults write autohide-delay -float 0; killall Dock

increase key repeat

defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)

turn off dock showing recent applications

go to System Preferences > Dock & Menu Bar, then uncheck the box for "Show recent applications in Dock"

turn off virtual desktops being re-arranged

go to System Preferences > Mission Control, then uncheck box for "Automatically rearrange Spaces based on most recent use"

speed up window minimise by changing effect to suck

defaults write mineffect -string suck; killall Dock

allow shift + cmd + l select all keybinding in vscode

go to System Preferences > Keyboard > Shortcuts > Services & uncheck Searching > Search With Google

bind caps-lock to ctrl

go to System Preferences > Keyboard > Modifier Keys & change Caps Lock to Control

ssh keys for gitlab & github

# github
ssh-keygen -t rsa -C -f ~/.ssh/id_rsa_GITHUB
cat ~/.ssh/
# add new key to github at

# gitlab
ssh-keygen -t rsa -C -f ~/.ssh/id_rsa_GITLAB
cat ~/.ssh/
# add new key to gitlab at

# get my ssh config which configures to use different key based on git hostname
curl >> ~/.ssh/config

# restart ssh agent
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist