-
-
Notifications
You must be signed in to change notification settings - Fork 688
Installing yabai (from HEAD)
If you want to run the latest and greatest version of yabai, you can install off of HEAD. Note that this will require codesigning with a self-signed certificate, so you'll have to create one first (and only once).
First, open Keychain Access.app. In its menu, navigate to Keychain Access, then Certificate Assistance, then click Create a Certificate.... This will open the Certificate Assistant. Choose these options:
- Name:
yabai-cert, - Identity Type:
Self-Signed Root - Certificate Type:
Code Signing
Click Create, then Continue to create the certificate.
Now onto installing yabai:
brew install koekeishiya/formulae/yabai --HEAD
codesign -fs 'yabai-cert' $(which yabai)Open System Preferences.app and navigate to Security & Privacy, then Privacy, then Accessibility. Click the lock icon at the bottom and enter your password to allow changes to the list. Add yabai manually by using the + labelled button. When installed using Homebrew, yabai will usually be at /usr/local/bin/yabai. Check the box next to yabai to allow accessibility permissions.
Now install the scripting addition.
# install the scripting addition
sudo yabai --install-saTo run yabai, simply start it and then restart Dock.app to load the scripting addition. Alternatively you can also logout and login again.
# start yabai
brew services start yabai
# load the scripting addition
pkill DockTo upgrade yabai to the latest version from HEAD, simply reinstall it with Homebrew, codesign it, reinstall the scripting addition and restart Dock.app again:
# set codesigning certificate name here (default: yabai-cert)
export YABAI_CERT=yabai-cert
# stop yabai
brew services stop koekeishiya/formulae/yabai
# reinstall yabai
brew reinstall koekeishiya/formulae/yabai
codesign -fs "${YABAI_CERT:-yabai-cert}" "$(brew --prefix yabai)/bin/yabai"
# reinstall the scripting addition
sudo yabai --uninstall-sa
sudo yabai --install-sa
# start yabai
brew services start koekeishiya/formulae/yabai
# load the scripting addition
killall DockThe below snippet makes yabai check for updates whenever it starts and automatically installs them for you, only requiring you to enter your password. Just put it at the end of your yabai configuration file and forget about it.
# set codesigning certificate name here (default: yabai-cert)
YABAI_CERT=
function main() {
if check_for_updates; then
install_updates ${YABAI_CERT}
else
osascript << EOM
display notification "Configuration loaded." ¬
with title "$(yabai --version)"
EOM
fi
}
# Please do not touch the code below unless you absolutely know what you are
# doing. It's the result of multiple long evenings trying to get this to work
# and relies on terrible hacks to work around limitations of launchd.
# For questions please reach out to @dominiklohmann via GitHub.
function check_for_updates() {
set -o pipefail
installed="$(brew info koekeishiya/formulae/yabai | grep 'HEAD-' \
| awk '{print substr($1,length($1)-6)}')"
remote="$(git ls-remote --head 'https://github.com/koekeishiya/yabai.git' \
| awk '{print substr($1,1,7)}')"
[ ${?} -eq 0 ] && [[ "${installed}" != "${remote}" ]]
}
function install_updates() {
script=$(mktemp)
cat > ${script} << EOF
#! /usr/bin/env sh
clear
printf "\e[1mUpdating yabai...\e[0m\n"
printf "Authenticate to continue, Ctrl+C to cancel.\n\n"
if sudo -v; then
brew services stop koekeishiya/formulae/yabai
brew reinstall koekeishiya/formulae/yabai
codesign -fs "${1:-yabai-cert}" "$(brew --prefix yabai)/bin/yabai"
sudo yabai --uninstall-sa
sudo yabai --install-sa
brew services start koekeishiya/formulae/yabai
killall Dock
sleep 1
fi
ps -eo pid,comm | grep -v grep | grep -i Terminal | tail -1 \
| awk '{print $1}' | xargs kill
EOF
chmod +x ${script}
open -FWnb com.apple.Terminal ${script}
rm -f ${script}
}
main &This wiki is a community–driven documentation page. If you want to request a topic for this wiki to address or discuss its content, head over to issue #5.
General
Installation
Configuration
Commands
Tips and Tricks
- Quickly restart the yabai launch agent
- Split yabai configuration across multiple files
- Fix spaces reordering automatically
- Fix folders opened from Desktop not tiling
- Auto updating from HEAD via brew
- Tiling Emacs
- Flash highlight to identify focused window
- Constrain space focus to current display with optional cycling