Configure MacOS for software development with yabai, skhd, karabiner and tmux

Gautham Dinesh
4 min readApr 15, 2024

I should be using Linux at this point but because I have a Macbook, I have to make do with what I have for customization. I use a 60% per cent keyboard with my external display and want to do almost everything in terms of moving around windows and resizing with my keyboard rather than the mouse.

Three tools that have helped me set up my MacOS keyboard shortcuts and software dev environment are yabai, skhd, karabiner and tmux.

Yabai

Yabai is a window/tiling manager for MacOS. It allows you to auto-split screens for windows, move focus, swap windows and more. However, to do more advanced customizations, System Integrity Protection needs to be partially disabled. I have decided not to do this because it can potentially expose your system to vulnerabilities so if you disable it, please understand the repercussions fully.

To get started with Yabai, visit the repo and follow the installation directions for your system. After installation, create a config file in ./config/yabai/yabairc. This will load your custom configurations for yabai. I have mostly used the default config but feel free to customize as you like. One thing I have found useful is disabling certain apps from being managed by Yabai:

yabai -m rule --add app="Spark Desktop" manage=off
yabai -m rule --add app="GK6+" manage=off

Your screen will look similar to this with two windows open but you can customize it to suit your tastes (p.s. you can see the Spark Desktop app behind the Terminal as it is unmanaged)

yabai window management

Karabiner

Karabiner is an app that lets you map your keys to perform other actions. This is especially useful for my 60% keyboard as I don’t have arrow keys. My Karabiner config is pretty simple:

  1. I have caps lock mapped to HYPER. HYPER is a special key that is a combination of shift + alt + option + command. This is very useful and lets you use caps lock as an additional FN key that can be mapped for shortcuts in skhd as you will see shortly.
  2. I have ctrl + hjkl mapped to arrow keys following Vim conventions.
  3. Finally, I have ctrl + cmd + hjkl mapped to normal MacOS cmd + left/up/down/right functions for moving screens and mission control.

It is pretty easy to configure Karabiner following the convention in json format.

SKHD

skhd is a hotkey daemon for MacOS. This lets you define keyboard shortcuts that can be used to execute other tasks. Viewing part of my config will give a better indication of how to use skhd:

# changing screen focus
lalt + lcmd - l: yabai -m display --focus east
lalt + lcmd - h: yabai -m display --focus west

# resizing window
hyper - l: yabai -m window --resize right:20:0; yabai -m window --resize left:20:0
hyper - h: yabai -m window --resize left:-20:0; yabai -m window --resize right:-20:0
hyper - j: yabai -m window --resize bottom:0:20; yabai -m window --resize top:0:20
hyper - k: yabai -m window --resize top:0:-20; yabai -m window --resize bottom:0:-20

You can see how I’ve mapped keyboard shortcuts to yabai actions and how the hyper-key set in Karabiner comes into use here.

Tmux

Tmux is a session/window/pane manager for MacOS. Essentially, it enables multiple terminal sessions in a configurable manner. This is useful when you are working on multiple tasks or files or windows at the same time. It allows you to create sessions that you can leave running in the background, detach from it and return to.

Within each session, you can have multiple windows and panes. A window is similar to a normal terminal window except that you can split this into multiple panes to have different things on the screen at the same time. In the screenshot, you can see named windows below and multiple panes within a single window.

tmux window

Tmux uses a prefix key combination (ctrl + b) before the action key to execute functions. E.g. to detach from a session, you would do ctrl + b followed by d. You can also configure tmux shortcuts as you wish in the config file. After nearly a year, I have just returned to playing around with tmux.

I hope you found this post helpful in helping you set up your own MacOS system for the best programming experience with keyboard shortcuts and window management.

--

--